Blender 2.8+, How to execute an operator in another window? Some operators are global. Some are not. Transform for example is bound to the window where it gets executed in. As an example let's say i want to perform the transform.rotate from the UV Editor in the UV menu of the 3D view?
All I found so far was some advice in the manual regarding execution context. This example maximizes the screen in all open 3D Views, from: https://docs.blender.org/api/current/bpy.ops.html
# maximize 3d view in all windows
import bpy

for window in bpy.context.window_manager.windows:
    screen = window.screen

    for area in screen.areas:
        if area.type == 'VIEW_3D':
            override = {'window': window, 'screen': screen, 'area': area}
            bpy.ops.screen.screen_full_area(override)
            break

But how would transform.translate fit in here? I'd like to get a button in 3D View .
To make it a bit more complicated, I don't only want to transform actually, I'd like to add back the old transform by 90 degrees back into its location. Which was:
layout.operator(&quot;transform.rotate&quot;, text=&quot;Rotate Minus 90&quot;).value = math.pi / -2


Do I still would have to write my own operator here? Or is there an easier way meanwhile?
The method from brockman. It shows one of the operator buttons. For the other direction simply use bpy.ops.object.simple_operator(val=math.pi/-2)
import bpy
import math
​
class SimpleOperator(bpy.types.Operator):
    &quot;&quot;&quot;Tooltip&quot;&quot;&quot;
    bl_idname = &quot;object.simple_operator&quot;
    bl_label = &quot;Simple Object Operator&quot;
    bl_options = {'REGISTER', 'UNDO'}
    
    val: bpy.props.FloatProperty()
    
    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    @classmethod
    def description(cls, context, properties):
        return properties.arg
​
    def execute(self, context):
        for area in bpy.context.screen.areas:
            if area.type == 'IMAGE_EDITOR':
                override = bpy.context.copy()
                override['area'] = area
                bpy.ops.transform.rotate(override, value = self.val)
        return {'FINISHED'}
​
​
def register():
    bpy.utils.register_class(SimpleOperator)
​
​
def unregister():
    bpy.utils.unregister_class(SimpleOperator)
​
​
if __name__ == &quot;__main__&quot;:
    register()
​
    # test call
    bpy.ops.object.simple_operator(val=math.pi/2)

Buttons:
    #buttons with separated tooltips. Put it in a menu or a panel
    myvar = layout.operator(SimpleOperator.bl_idname, text=&quot;Rotate Counter Clockwise&quot;).arg = 'Tooltip for Rotate Counter Clockwise'
    myvar.val=math.pi/2

    myvar = layout.operator(SimpleOperator.bl_idname, text=&quot;Rotate Clockwise&quot;).arg = 'Tooltip for Rotate Clockwise'
    myvar.val=math.pi/-2