# Is it possible to dump an Objects Properties and Methods?

Due to the lack of a class diagramm I need to explore the data structures by dumping objects to see what is in there.

How can I dump the Objects internals to the console?

In this snippet I tried to print the objects but I only get error messages 'TypeError'

def assignPose( plIdx ):
rig = bpy.data.objects.get("rig")

if rig != None:
print("rig=" + str(tuple( rig ))) # TypeError: 'Object' object is not iterable
print( "" + rig.__str__ )         # TypeError: Can't convert 'method-wrapper' object to str implicitly
pl = rig.pose_library
pl.poselib_apply_pose( plIdx )
else:
print("couldn't find rig.")

• What do you want to see as output exactly? If you want bones of the rig try tuple(rig.data.bones). If you want to get names of properties of rig itself, try dir(rig) – mg007 Jul 18 '13 at 6:55
• Pure Python questions like this are better placed over at Stack Overflow. As you've found, there are many pre-existing ones there too, here's another: How do I look inside a Python object? – Aldrik Jul 18 '13 at 9:37
• @Aldrik I had to try several approaches since not all of them work with blenders data structures, so I posted the answer to document this for later reference. – stacker Jul 18 '13 at 10:42
• @stacker Python has built-in functions to do what your after, see link in previous comment. – Aldrik Jul 18 '13 at 11:32

I found a solution to get started:

def dump(obj):
for attr in dir(obj):
if hasattr( obj, attr ):
print( "obj.%s = %s" % (attr, getattr(obj, attr)))


This is based on one of the methods suggested on this Stackoverflow post and this

Instead of invoking print call dump( anyobject )

This would print something like:

...
obj.copy = <bpy_func Object.copy()>
obj.cycles_visibility = <bpy_struct, CyclesVisibilitySettings("")>
obj.data = <bpy_struct, Armature("rig")>
obj.delta_location = <Vector (0.0000, 0.0000, 0.0000)>
obj.delta_rotation_euler = <Euler (x=0.0000, y=0.0000, z=0.0000), order='XYZ'>
obj.delta_rotation_quaternion = <Quaternion (w=1.0000, x=0.0000, y=0.0000, z=0.0
000)>
obj.delta_scale = <Vector (1.0000, 1.0000, 1.0000)>
obj.dimensions = <Vector (0.0000, 0.0000, 0.0000)>
obj.draw_bounds_type = BOX
obj.draw_type = WIRE
obj.dupli_faces_scale = 1.0
...

• Please add a reference (stackoverflow.com/a/192184/155813 ?) from where you found the solution, so that others can explore related solutions/comments. – mg007 Jul 18 '13 at 7:06
• @mg007 Good idea, added a reference btw. this was the only one working with blenders objects. – stacker Jul 18 '13 at 8:19
• I've built off this idea and extended it to do some recursion / memo-ization: blender_dumpy.py - example snippet from the Race Spaceship demo: gist snippet – Eric Cousineau Oct 19 at 0:42

There is already an addon called API Navigator to explore the API. It has to be enabeld first in the User Preferences

• Looked for this in 2.80, but guessing it may not be maintained :( See above comment for my hacky workaround based on object enumeration. – Eric Cousineau Oct 19 at 0:45