When i want to move the Origin of an object by script, then i can do this as follows:
my_location = [0,0,0]
active = scene.objects.active
cursor = scene.cursor_location.copy()
scene.objects.active = obj
scene.cursor_location = my_location
bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
scene.cursor_location = cursor
scene.objects.active = active
Is there an efficient alternative which works without need to backup/restore the active object and the current cursor location ? If not, is it missing or is there a reason ?
bpy.ops.object.select_all(action='DESELECT')
) and you need to setobj.selected = True
. And afterwards, you need to iterate over your stored previous selection and restore the selected state $\endgroup$