Switch between pivot point in image_editor from python

Hi, I’m writing an addon that goes way beyond my python knowledge, but anyways.
Right now I would need to change the pivot in image_editor window to 2D Cursor before a function operates over selected UVs.
I would like it to change it even if there’s no image editor window visible, and if there is one, change it there.
I figure it should be a for loop that cycle through all active windows and…
if area.type == ‘IMAGE_EDITOR’:
I would need to make it to “active” and change the pivot there and then come back
Any help more than appreciated.
Thanks a lot!