So I have a very specific problem. I'm writing a script that's doing some things and at a certain point, it switches the current workspace (whatever it is) to the UV Editing workspace. After doing what it's supposed to do I want to display a simple pop-up window telling something. I already did that.
The problem is that the pop-up window ONLY displays in the window that the script was run from (the context window) and after the workspace switch the pop-up never appears. It only appears if the script was run in the UV Editing workspace because it never switches.
class MessageBox(bpy.types.Operator):
bl_idname = "shell_create.messagebox"
bl_label = "Attention!"
message = "Message that appears"
def execute(self, context):
return {'FINISHED'}
def invoke(self, context, event):
return context.window_manager.invoke_props_dialog(self, width = 350)
def draw(self, context):
self.layout.label(text=self.message)
Now, I think that it all comes from the "context" that I'm passing in the draw() method but I have no idea how to "tell" it to appear at a specific location (in my case the UV Editing workspace)
Does anyone have any idea how I could do that?
Thank you in advance!!!
P.S:
This is the way I'm switching the workspace:
w_space = bpy.context.workspace.name
if w_space != 'UV Editing':
bpy.context.window.workspace = bpy.data.workspaces["UV Editing"]