3
$\begingroup$

I have an operator with a class name of say Mesh_OT_Add_Thing. Printing self.__class__ shows that the class is __main__.Mesh_OT_Add_Thing. I've tried a few different ways but can't seem to get to the class to check a specific member.

How do I do this?

$\endgroup$
2
  • $\begingroup$ Where do you want to access your Operator class? I can successfully access another Operator class from the same directory using from . import my_operator. And I think it is also possible using class path. $\endgroup$ Jan 20, 2015 at 4:45
  • $\begingroup$ From the python command line in blender. Ill try the import thing when i get time tomorrow and use the from [path] part you suggested and let you know the results $\endgroup$
    – Cobertos
    Jan 20, 2015 at 4:57

1 Answer 1

3
$\begingroup$

You can access classes for registered operators via bpy.types.

eg:

cls = bpy.types.OBJECT_OT_make_dupli_face

import inspect

inspect.getsourcefile(cls)
# 'release/scripts/startup/bl_operators/object.py'

inspect.getsource(cls)
# 'class MakeDupliFace(Operator):\n    """Convert objects ... <snip>
$\endgroup$

You must log in to answer this question.

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