Selecting an object and change to Edit Mode


I’m running the script below on the default start-up blend file, and the cube is selected with a deep orange color. See attached image.

When the cube is selected with this deep color it can’t be change in to Edit mode!

I’m confused by this, does anyone know how to modify the script below and take the cube into edit mode?

import bpy
from bpy import context

ob =[‘Cube’] = True


The dark orange colour indicates that it is selected but is not the active object. It is the active object that you can toggle between object and edit mode

Add two cubes in your scene, select both of them and you’ll see one is dark orange and the other light orange. The light orange object is the active object and is the one that will go into edit mode

Ok, thanks, I didn’t see the difference between ACTIVE and SELECTED objects. The image below illustrate the difference.