The UI shows the following:
However when I run
bpy.data.screens['Layout'].overlay.show_stats, there is an error:
AttributeError: 'Screen' object has no attribute 'overlay.
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.Sign up to join this community
Look at the type.
Sometimes the tooltips can be screwy as shown in question the
overlay is not a property of screen.
On the bpy.types.View3DOverlay help page linked go to the bottom to references.
WIll see a link to SpaceView3D.overlay
which is the space assigned to the 3d view.
In the python console
>>> for i, a in enumerate(C.screen.areas): ... i, a.type ... (0, 'PROPERTIES') (1, 'CONSOLE') (2, 'OUTLINER') (3, 'VIEW_3D') >>> >>> space = C.screen.areas.spaces.active >>> space.overlay.show_stats True >>> type(space) <class 'bpy.types.SpaceView3D'> >>> type(space.overlay) <class 'bpy.types.View3DOverlay'>
If a script is run within the context of the 3Dview area, a panel draw, menu shortcut etc, then
space = context.space_data
The blender screen is split into areas. When you change the area type in UI, the active space used is associated with that type. When you see the type
SpaceFoo you know its the space of the "Foo" area. eg "SpaceProperties", "SpaceConsole"