Single add-on or script can contain several different operators, and not all of them may be registered in the API by the register() function. To verify that the required operator is registered in the Blender API, run the following command:
1 |
hasattr(bpy.types, bpy.ops._operator_bl_idname_.idname()) |
Where:
_operator_bl_idname_ – the text value of the bl_idname operator property.
For example for an operator:
1 2 3 4 5 6 |
class TestOperator(bpy.types.Operator): bl_idname = 'test.operator' bl_label = 'Test operator' def execute(self, context): pass |
the command will look like this:
1 |
hasattr(bpy.types, bpy.ops.test.operator.idname()) |