The order is important if both parent and child panels are custom. Register the parent panel first, then the child.
Example adding parent/child panels in Object tab
from bpy.types import Panel
# mixin so we don't have to define for each class
class ObjPanel(Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "object"
class OBJECT_PT_Parent(ObjPanel):
bl_label = "Parent"
def draw(self, context):
self.layout.row().label(text="Parent panel")
class OBJECT_PT_Child(ObjPanel):
bl_parent_id = "OBJECT_PT_Parent"
bl_label = "Child"
def draw(self, context):
self.layout.row().label(text="Child panel")
def register():
from bpy.utils import register_class
register_class(OBJECT_PT_Parent) # register first
register_class(OBJECT_PT_Child)
if __name__ == "__main__":
register()
How do we layout with these subpanels? To me it seems, they always are placed at the end of a parent_id layout. hence theres no way to place options and buttons below a subpanel. Not very useful, is it?