I'm making a script to automate some steps I do quite often. In the script I need to change the active selection from one object to another to work on that object and then return the active selection to the first one, e.g. I have a cube and a circle, both separated objects, I do some things with the cube and then I have to select the circle to do some other operations, then when I'm done with that, I want to select the cube to keep working with it, thanks in advance.

  • $\begingroup$ see if this helps blender.stackexchange.com/questions/44382/… $\endgroup$ – m.ardito Aug 19 '17 at 6:55
  • $\begingroup$ That helps to select it, but I want to change the "active" property, so when you go bpy.context.active_object the object is now the second one. In other words I need to convert a secondary selection into the active and the active into the secondary, thanks for the reply nonetheless. $\endgroup$ – DeNapes Aug 19 '17 at 18:42

I found the answer here.

The way you make an object active is through the overwrite of:


so if you have a Cube named 'Cube', and you want to make it active, you will do:

cube = bpy.data.objects['Cube']
bpy.context.scene.objects.active = cube
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.