I found out that I can remove panels via python with these command:


Ican then customize my interface with an addon. My problem is that I get an error if the panel is already unregistrered. Is there a way to check before unreg? like so:

if bpy.types.SCENE_PT_physics not None:

EDIT (after reply):

Ok so I try do it as posted by Duarte Farrajota Ramos. But would like to automate it so I don't have to write in a console - like this:

import bpy

all_classes = (

for single_class in all_classes:
    module = single_class.__module__

    from module.name import single_class

    if module.single_class.is_registered:
    #Do stuff

This doesn't work and I'm not sure how to handle pythons types. That is I'm confused when I have a string of the name of the module or when I have the object it self and what I'm supposed to use when importing several variable modules ect.

  • 4
    $\begingroup$ hasattr(bpy.types, "SCENE_PT_physics") $\endgroup$
    – lemon
    Commented Nov 23, 2020 at 15:04

1 Answer 1


Import the class def

If a type is in bpy.types.FOO it implies it is registered.

Wouldn't recommend unregistering using


particularly if you wish to re-register it, as unregistering it removes it from bpy.types.

Rather, would recommend importing them. If you are not sure where the classes are defined, turn on developer extras and view source or check the classes module property

>>> bpy.types.SCENE_PT_physics.__module__

Hence can import it, check if it is registered by looking at its is_registered property

>>> from bl_ui.properties_scene import SCENE_PT_physics
>>> SCENE_PT_physics.is_registered

>>> bpy.utils.unregister_class(SCENE_PT_physics)

and then re-register if need be to "uncustomize"

>>> SCENE_PT_physics.is_registered

>>> bpy.utils.register_class(SCENE_PT_physics)

Note, since most Blender UI code sticks to the convention of putting registerable classes in a list named classes can use this, or the modules register methods.

>>> from bl_ui.properties_scene import classes
>>> classes
(<class 'bl_ui.properties_scene.SCENE_UL_keying_set_paths'>, <class 'bl_ui.properties_scene.SCENE_PT_scene'>, <class 'bl_ui.properties_scene.SCENE_PT_unit'>, <class 'bl_ui.properties_scene.SCENE_PT_physics'>, <class 'bl_ui.properties_scene.SCENE_PT_keying_sets'>, <class 'bl_ui.properties_scene.SCENE_PT_keying_set_paths'>, <class 'bl_ui.properties_scene.SCENE_PT_keyframing_settings'>, <class 'bl_ui.properties_scene.SCENE_PT_audio'>, <class 'bl_ui.properties_scene.SCENE_PT_rigid_body_world'>, <class 'bl_ui.properties_scene.SCENE_PT_rigid_body_world_settings'>, <class 'bl_ui.properties_scene.SCENE_PT_rigid_body_cache'>, <class 'bl_ui.properties_scene.SCENE_PT_rigid_body_field_weights'>, <class 'bl_ui.properties_scene.SCENE_PT_custom_props'>)


The module bl_ui is blenders UI written in python. The classes listed above are all the UI elements listed in bl_ui.properties_scene ie the PROPERTIES area in SCENE tab.

The idea here is to not use the class from bpy.types rather import it from its appropriate UI submodule.

Hence in your addon code would

from bl_ui.properties_scene import SCENE_PT_physics

As an example, to take out all panels in the Scene Properties

import bpy
from bpy.types import Panel

import bl_ui
# all panels in PROPERTIES > SCENE
scene_prop_panels = [cls for cls in bl_ui.properties_scene.classes
        if issubclass(cls, Panel)]
def register():
    # unregister default scene props panels
    for cls in scene_prop_panels:
        if cls.is_registered:

def unregister():
    # unregister default scene props panels
    for cls in scene_prop_panels.reversed():
        if not cls.is_registered:
if __name__ == "__main__":
  • $\begingroup$ Thanks! This looks very useful. I asked this in a previous question this day, but is there a way to execute these commands from a seperate module when the addon is loaded? I guess its best not to put them in the init.py file $\endgroup$
    – DrDress
    Commented Nov 23, 2020 at 18:17
  • 1
    $\begingroup$ EDIT added after seeing attemptus horriblus in question code. Please in future if having trouble Post Your Code, and we can see where you are going astray and help. Similarly here blender.stackexchange.com/questions/202854/… and blender.stackexchange.com/questions/202854/… Also see links posted yesterday blender.stackexchange.com/questions/202854/… re calling the register of other modules from __init__.py $\endgroup$
    – batFINGER
    Commented Nov 24, 2020 at 11:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .