import bpy from bpy.types import Menu from .funcs import get_scene_workspaces class WBS_MT_missing_workspaces(Menu): bl_label = "Link other workspaces" def draw(self, context): layout = self.layout present = False for w in bpy.data.workspaces: if w.name not in get_scene_workspaces(): present = True layout.operator("wbs.sel_workspace", text=w.name, icon="ADD").workspace = w.name if present: layout.separator() layout.operator("wbs.sel_all", text="Link all workspaces")