.select() – Select a Maya object using Python

Use this to select an object, example:

// Import Maya commands
from maya import cmds

// Create a cube
cube = cmds.polyCube()

// Place the cube object into a variable
cubeShape = cube[0]

// Select the cube object
cmds.select(cubeShape)