As a script author you have limited control of panel ordering.
- You can change the initial order they show in relation to each other.
(for multiple panels you define)
- You can't change the order they display in relation to other panels
(defined by other scripts for example).
- You can't change the order of panels in existing blend files
(see workaround below *).
Panels are shown in the order they are registered,
This means if you use bpy.utils.register_module(__name__)
the order they're defined.
Since having to re-arrange code just to change panel order is inconvenient. You can register each class explicitly with bpy.utils.register_class(cls)
, and re-arrange the order of registration this way. See example.
Note that once the panels are saved in a file - their order is saved too. To ignore the saved order you will you will need to load the blend with Load UI disabled.
* You can workaround this and ignore saved panel location in existing files - by renaming the class. (admittedly a kludge).