How do I add a button to "Background Images" panel in 2.8?

I can’t find the proper python notation to access the layout. Closest I have is “context.scene.camera.data” but that puts my button at the bottom of the list of options.

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

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

        #obj = context.scene.camera.data
        obj = context.camera

        row = layout.row()
        row.label(text="Import Metadata", icon='PREVIEW_RANGE')

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

        row = layout.row()
        row.operator("mandelbulber.metadata")
def background_image_panel(self, context):
    layout = self.layout
    obj = context.object
    
    col = layout.column()
    col.label(text="Import Metadata", icon='PREVIEW_RANGE')
    col.label(text="Active object is: " + obj.name)
    col.prop(obj, "name", text="Name")
    col.operator("mandelbulber.metadata")


def register():
    bpy.types.DATA_PT_camera_background_image.append(background_image_panel)


def unregister():
    bpy.types.DATA_PT_camera_background_image.remove(background_image_panel)
1 Like