A recent question / answer involves what looks like an overridden operator


differing from the documented default, how do we find which addon(s) have registered the operator.

Method 1,.

Edit to match operator id.

op_name = "import_scene.obj"


import addon_utils
from bpy.types import Operator
from importlib import import_module
import inspect

op_name = "import_scene.obj"

for m in addon_utils.modules():
    name = m.__name__
    default, loaded = addon_utils.check(name)
    if loaded:
        mod = import_module(name)
        classes = getattr(mod, "classes", [])
        for c in classes:
            if (
                issubclass(c, Operator) 
                getattr(c, "bl_idname", "").startswith(op_name)
        if not classes:
            for k in dir(mod):
                cls = getattr(mod, k, None)
                if inspect.isclass(cls) and issubclass(cls, Operator):
                    id = getattr(cls, "bl_idname", "")
                    if id.startswith(op_name):

by either looking at the addons classes or inspecting all objects of enabled addons. How do I run an existing add-on via the python API?

Method 2,.

This approach disable, check op is still registered, re-enable...

Edit your operator of interest into

op_id = bpy.ops.import_scene.obj.idname()


import addon_utils
import bpy

op_id = bpy.ops.import_scene.obj.idname()

for m in addon_utils.modules():
    name = m.__name__
    default, loaded = addon_utils.check(name)
    if loaded:
        if not hasattr(bpy.types, op_id):

How would you approach finding an operators registering addon(s) from its id name?.

Note: don't save preferences after running this as addon prefs could be lost after disable.

  • $\begingroup$ for me, on script 1: line 15: AttributeError: 'tuple' object has no attribute 'startswith' $\endgroup$ – james_t Mar 23 at 15:18
  • 1
    $\begingroup$ Have put in fix for that, prob could flag it since it is "usual practice" to have a tuple for a "bl_idname" $\endgroup$ – batFINGER Mar 23 at 15:31
  • $\begingroup$ super! thanks, unfortunately op_name = "bpy.ops.object.align" returns nothing for me, nor does op_name = "bpy" ! $\endgroup$ – james_t Mar 23 at 16:10
  • $\begingroup$ ah i changed to op_name in getattr(c, "bl_idname", "") and now op_name = "align" returned "space_view3d_align_tools", so this is getting me what I need to know. Perhaps I would disable this add-on to help solve my problem. thanks again!!! $\endgroup$ – james_t Mar 23 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.