0

The Properties editor has several categories.

among several tabs, I want to click on the modify tab using python.

enter image description here

but this seems not to be working. How can I write a script that clicks various tabs of the Properties Editor?

Here is my code:

import bpy
bpy.context.space_data.context = 'MODIFIER'

enter image description here

minia
  • 35
  • 6

1 Answers1

1

You'd have to iterate through Screen.areas, find the Properties Editor and set the space:

import bpy

C = bpy.context

for area in C.screen.areas: if area.type == 'PROPERTIES' and
C.object.type not in ('LIGHT_PROBE', 'CAMERA', 'LIGHT', 'SPEAKER'): # Set it the active space area.spaces.active.context = 'MODIFIER' # 'VIEW_LAYER', 'SCENE' etc. break # OPTIONAL

Further reading: poll() failed, context incorrect?

brockmann
  • 12,613
  • 4
  • 50
  • 93