I'm trying to change the tile_grid_shape in the UV Editor window located in the UV Editing workspace. The problem is that the only way to do this that I found is bpy.context.... but using context is not an option in my case since the context is actually a different window. If I change the context to be UV Editor it changes the tiles in that window and not in the one in the UV Editing workspace.
This is what I tried with no success:
for area in bpy.data.screens['UV Editing'].areas:
if area.type == 'IMAGE_EDITOR':
area.type.uv_editor.tile_grid_shape[0] = 3
In this case I'm getting an error that 'str' object has no attribute 'uv_editor'
I also tried this:
bpy.data.screens['UV Editing'].uv_editor.tile_grid_shape[0] = 3
Still no success though. I'm getting an error that 'screen' object has no attribute 'uv_editor'
I got it from here, but it doesn't work. I guess they changed it and didn't correct it here.
I also know of one other method with context override where you copy the context and do whatever you want in the new one, but the problem with that is that you can't delete the newly created context and when using it in a big batch it makes thousands of context copies and takes a lot of memory that you can't clear unless you restart Blender.
So does anyone have any idea how to do this thing?