# Access python data path with ... (Ellipsis)

I am trying to access a bool property in the python API to see if an option is enabled or not. The python tooltip for the option says this:

bpy.data.screens['Default']...show_grease_pencil


I try to use that in the console or in py scripts, and it says the ellipsis(...) is invalid syntax. What am I missing? (Ignore the tooltip text. I originally thought the '...' was just hiding some of the API). I tried it with double quotes and that didn't help.

• I have to say this quirk really slows me down when I'm exploring new corners of the python API. Just today I was up to my armpits in drivers and the tooltip just told me bpy.data.objects["Armature"]...type . After a great deal of flailing about in the python console i was able to figure out that it was bpy.data.objects["Armature"].animation_data.drivers[0].driver.variables[0].type . I look forward to the day when the tooltips save me an hour of fumbling in the dark. Mar 28 '14 at 21:26

It is a quirk of Blender's current UI, but actually you can deduce its location a bit, helped by Blender's API documentation.

# Direct Access

The property you're looking for is SpaceView3D.show_grease_pencil, that one is clear. Now, what class contains a Space (SpaceView3D's ancestor)? Scroll down to References section in that class' docs. One of references there leads to Area.spaces. This is easy, because one of its docs' Reference leads to Screen.areas, and Screen is the type of what's visible before the ellipsis. So the attribute's full path is:

bpy.data.screens['Default'].areas[X].spaces[Y].show_grease_pencil


... where X depends on the screen's subdivision, and Y is 0 if the 3D View is visible in that area. You can find that out from Console:

# Using Context

It's easier to read 3D View space's settings through bpy.context, e.g.:

• Use bpy.context.space_data, if the 3D View area is active (i.e. accessed through an operator executed from the 3D View itself).
• Use bpy.context.area.spaces[1], if accessed through a Console whose display type is directly switched from a 3D View.
• Use bpy.context.screen.areas[X].spaces[0] if accessed through a Console in another area, index X must be searched beforehand.

The same show_grease_pencil attribute is accessible through these different paths.

• Great explanation. Thank you. It can be confusing since there is an operator called ... that I thought it was referencing somehow. Dec 7 '13 at 17:48