Go to: Synopsis. Return value. Related. Python examples.

Synopsis

objExists( string )

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

objExists is undoable, NOT queryable, and NOT editable.

This command simply returns true or false depending on whether an object with the given name exists.

Return value

boolean

Related

addAttr, aliasAttr, attributeInfo, attributeQuery, deleteAttr, getClassification, nodeType, objectType, renameAttr

Python examples

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.")