Setting the Context Window Screen Layout Explicitly in BPY
The current workspace can be changed to the UV Editing workspace through:

bpy.context.window.workspace = bpy.data.workspaces['UV Editing']


This assumes that a workspace named UV Editing exists. In order to check for the case where it doesn't exist, use bpy.data.workspaces.get('UV Editing') instead and verify that the returned value is not None.



The current area type can be changed through bpy.context.area.type. In order to change to the UV editor you can use:

area = bpy.context.area
area.type = 'IMAGE_EDITOR'
area.ui_type = 'UV'


Although it's not documented in the manual you can also just assign the ui_type and it will automatically change the type as well.

bpy.context.area.ui_type = 'UV'


If you want to change a different area than the current one, you can iterate through bpy.context.screen.areas.