# How to access a class from blenders python console?

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?

• 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. – TheBusyTypist Jan 20 '15 at 4:45
• 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 – Coburn Jan 20 '15 at 4:57

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>