operator consistent

given: object A is selected, object B is active


bpy.ops.object.origin_set()

effects object A

BUT

bpy.ops.object.editmode_toggle()

effects object B

do i need to do a

    bpy.data.objects[...].select = True
    bpy.context.scene.objects.active = ...

so i can be sure EVERY operator will effect the desired object?

niko

This is the same as when you do it ‘by hand’ rather than using the Python API. The general rule of thumb is that anything that can apply to multiple objects works on all those currently selected, while anything that can only apply to one object works on the active one.

Best wishes,
Matthew

if you wanna make sure that only 1 object will be affected, you could

  • deselect everything
  • select the single object
  • make that object active