What happens exactly, is that after duplicating an object, then deselecting all selected objects, using:


then running:


object is selected in red outline, not orange as usual, as a result, when editing object in edit mode, also in python, it doesn't work either however, before running bpy.ops.object.duplicate(), everything works properly.

I stumbled at this weird problem for a long while, i wonder how to fix it

  • 1
    $\begingroup$ Could you please accept and upvote the answer if it was helpful? $\endgroup$
    – Tak
    Jan 26, 2017 at 13:17
  • $\begingroup$ Does this answer your question? Set active object with python $\endgroup$
    – Manik
    Mar 4 at 20:53

1 Answer 1


You need to set the object to be the active object as well as selected

The below code works for me, I just added a Cube at origin (0, 0, 0) selected it then run this script from the text editor (or you can run it from the console as well):

import bpy
C = bpy.context
scene = C.scene
scene.objects.active = bpy.data.objects['Cube']

This is what happens after running the script:

enter image description here


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.