How to get Properties Editor tabs context for the active object? I'm trying to find the available Properties Editor tabs of the active object. bpy.context.space_data.context (when accessed inside the Properties Editor) indicates which tab is being displayed and can be used to set the active tab. To do this with code you should know ahead of time which tabs (panels, menus, etc.) are available for the active object (i.e. armature vs a mesh type). For instance if you set bpy.context.space_data.context = "cheese" (while in the Properties Editor) with a mesh object active you get this error message:  

TypeError: bpy_struct: item.attr = val: enum "cheese" not found in 
('TOOL', 'RENDER', 'OUTPUT', 'VIEW_LAYER', 'SCENE', 'WORLD', 'OBJECT', 'MODIFIER', 
'PARTICLES', 'PHYSICS', 'CONSTRAINT', 'DATA', 'MATERIAL', 'TEXTURE')


Are these values stored in the object context somewhere? Is there some other way I can access a list of available Property Editor tabs context for the active object, or will I have to map these out manually? space_properties.py doesn't seem to be much help here.
Dynamic enum property.

This is a dynamic enum property, ie it changes dependant on context.

We can get all possible members, from the properties rna data  enum_items

&gt;&gt;&gt; for i, a in enumerate(C.screen.areas):
...     i, a.type
...     
(0, 'PROPERTIES')
(1, 'CONSOLE')
(2, 'OUTLINER')
(3, 'TEXT_EDITOR')

&gt;&gt;&gt; s = C.screen.areas[0].spaces.active
&gt;&gt;&gt; s.bl_rna.properties['context'].enum_items.keys()
['TOOL', 'SCENE', 'RENDER', 'OUTPUT', 'VIEW_LAYER', 'WORLD', 'OBJECT', 'CONSTRAINT', 'MODIFIER', 'DATA', 'BONE', 'BONE_CONSTRAINT', 'MATERIAL', 'TEXTURE', 'PARTICLES', 'PHYSICS', 'SHADERFX']


or similarly from the type

bpy.types.SpaceProperties.bl_rna.properties['context']


whereas the error message, as shown in question, shows those members available for that context. 

A dynamic enum property has a method that populates its items depending on context. I am unaware of how to tap into the method and get only context members.  

Pinning an object to the panel also changes context tabs displayed.

Henceforth apping them out manually (with some assistance) is AFAIK going to have to do.

This is one of the rare cases where I would recommend using try / except clause.  We could for instance write a script that creates sets for each data type.  We know the union (above) and can find a common set and those unique to each type.  For instance can grep the context members out of the exception message.  Pretty ugly example below, mesh object selected in edit mode, improve using re expression perhaps.

&gt;&gt;&gt; try:
...     s.context = "Foo"
... except TypeError as e:
...     m = str(e.args)
...     m[m.find("(", 1) + 1:-4].replace("\\'", "").replace(" ", "").split(",")
...     
['TOOL', 'RENDER', 'OUTPUT', 'VIEW_LAYER', 'SCENE', 'WORLD', 'OBJECT', 'MODIFIER', 'PARTICLES', 'PHYSICS', 'CONSTRAINT', 'DATA', 'MATERIAL', 'TEXTURE']


Worth mentioning that DATA will display mesh data for a mesh object, armature data for an armature object,  curve data for a curve etc