Can only register one class

Just started working on my first addon and I’ve been having problems with a script where I have two panels defined as classes and then registering both of them sequentially. One goes in Scene Properties and one in Object Properties. Only the last class registered ever appears in the UI, they both work if I swap the registration order. I made a simplified test straight from the Templates menu and it behaves the same.

Can anyone tell me what obvious thing I’m doing wrong. Blender 3.4.1 on Ubuntu 20.04

Cheers

Pete

import bpy


class HelloWorldPanel(bpy.types.Panel):
    """Creates a Panel in the Object properties window"""
    bl_label = "Hello World Panel"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"

    @classmethod
    def poll(self,context):
       return context.object is not None

    def draw(self, context):
        layout = self.layout

        obj = context.object

        row = layout.row()
        row.label(text="Hello world!", icon='WORLD_DATA')

        row = layout.row()
        row.label(text="Active object is: " + obj.name)
        row = layout.row()
        row.prop(obj, "name")

        row = layout.row()
        row.operator("mesh.primitive_cube_add")

class HelloWorldPanel2(bpy.types.Panel):
    """Creates a Panel in the Object properties window"""
    bl_label = "Hello World Panel2"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "scene"

    @classmethod
    def poll(self,context):
        return context.object is not None

    def draw(self, context):
        layout = self.layout

        obj = context.object

        row = layout.row()
        row.label(text="Hello world Again!", icon='WORLD_DATA')

        row = layout.row()
        row.label(text="Active object is: " + obj.name)
        row = layout.row()
        row.prop(obj, "name")

        row = layout.row()
        row.operator("mesh.primitive_cube_add")

def register():
    bpy.utils.register_class(HelloWorldPanel2)
    bpy.utils.register_class(HelloWorldPanel)

#def unregister():
#    bpy.utils.unregister_class(HelloWorldPanel)
#    bpy.utils.unregister_class(HelloWorldPanel2)

if __name__ == "__main__":
    register()

The bl_idname must be unique, so when you change one of them, both classes will probably be registered.

This is indeed the case.

Thanks!