Go to: Synopsis. Return value. Related. Python examples.
objExists(
string
)
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
objExists is undoable, queryable, and editable.
This command simply returns true or false depending on whether an object with the given name exists.boolean
In query mode, return type is based on queried flag.
import maya.cmds as cmds # Select an object if and only if it exists. # Print a warning if it does not exist. if cmds.objExists('surface1'): cmds.select('surface1') else: print("Warning: no surface exists.")