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):

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!!!


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"]
  • $\begingroup$ If you call the operator in 3Dviewport, the dialog will display in the 3Dviewport, you can add a shotcut to call it. If you want the message always on your screen, you have to try another method. $\endgroup$
    – X Y
    Commented Feb 10, 2021 at 7:19
  • $\begingroup$ I don't have a problem with the message displaying in the viewport. It just displays in the wrong viewport. I want to "tell" it to display at a specific location (the viewport in the UV Editing workspace). I think that when executing the two methods "execute" and "invoke" I have to pass something else, something that's not "context" but the actual window for example $\endgroup$
    – Aleks K.
    Commented Feb 10, 2021 at 10:35
  • $\begingroup$ Please clarify how you are switching workspace. $\endgroup$
    – batFINGER
    Commented Feb 10, 2021 at 12:01
  • $\begingroup$ I added it in the description $\endgroup$
    – Aleks K.
    Commented Feb 11, 2021 at 6:22


You must log in to answer this question.

Browse other questions tagged .