How do I write a script that would goto my custom workspace and initiate the mode set.

I want it so when I swipe to Modelling in my pie menu it chooses my "Modelling" workspace and goes to object mode, not edit mode.

I have pie menus installed, will I write it in script from then run it from pie.

here are some of the code snippets I've managed to collect.

wm.context_set_id Context Attribute: window.workspace Value: Modeling object.mode_set

wm.context_set_id Context Attribute: window.workspace Value: Sculpting sculpt.mode_set


1 Answer 1


bpy.context.window_manager.windows[0].workspace = bpy.data.workspaces['Modeling'] bpy.ops.object.mode_set(mode='OBJECT')

  • $\begingroup$ it appears you can't stop it from always going into edit mode, why blender, WHY! $\endgroup$ Jul 30, 2021 at 14:25
  • $\begingroup$ well, the whole point of having a modeling workspace is to model, ie, edit, so that's why. You can delete it and add your own workspace that you call it Modeling. If you derive that workspace from Layout it can be set up any way you want. $\endgroup$ Jul 30, 2021 at 14:59
  • $\begingroup$ It's cool, I just model and sculpt with-in the workspace now, don't need to worry about what I was trying to do above. Was cool that workspaces change the desired tabs and buttons to ones preference. meh! $\endgroup$ Aug 11, 2021 at 13:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .