How to verify if an node exist in the scene?


Hey guys!
i am new for python, i am sorry for the begginner doubt…

how can i verify if an node exist in the scene?

in maxscript i usually do this:
if someting == undefined do print “do not exist”

how can i make it in python?

i would like to get someting like this:

if transformNode exists:

thank you everyone!

import maya.cmds as cmds
if cmds.objExists(node_name):


woww man! thank you so much!!!


You can also, via pymel, do something like this:

import pymel.core as pm
    node = pm.PyNode("node_name")
except pm.MayaNodeError: 

The above is a bit more pythonic. Rather than checking for existence, assume it’s there and if not, handle the issue.


thanks a lot, sorry for delay the replying!