Switching workspaces in Blender using Python API

Workspaces in Blender are saved sets of work areas (windows of the desired type). Typically, switching between them is done by clicking on the tab with the name of the workspace at the top of the Blender UI. We can also switch between workspaces using the Blender Python API.

We can get a list of all available workspaces using the following command:

The currently active workspace is stored in the “context.window.workspace” parameter:

To switch to the desired workspace, we need to assign this parameter the value of the required workspace:

Workspaces can be imported from external Blender files using the “bpy.ops.workspace.append_activate” operator.

For example, to import the “Shading” workspace from the startup file, we need to execute this operator as follows:

The specified workspace will be imported into the current session and Blender will switch to it.

0 0 votes
Article Rating
Notify of

0 Comment
Inline Feedbacks
View all comments