import re
import pymel.core as pm
path = pm.control("string_name_of_control", query=True, fullPathName=True )
ack = re.findall("[^|]+$", path)[0] # Gets the control name
ack = pm.PyNode(ack) # Convert to node
print ack.getValue()
# MayaNodeError: Maya Node does not exist (or is not unique):: u'string_name_of_control' #
I have a problem where I need to alter something of a UI control after a script has been executed. Passing variables between scripts is in this case not possible. I have assigned a string name to the control and assigned it to a variable. And so far, so good. I can fetch the name of the control without any problems.
But as soon as I turn the name of this control into a node using pm.PyNode(), followed by the getValue() command I get this Maya Node Error. Why?
Best example of replicating this problem is to say, creating a window with one script and then having another script query a control in said window.
EDIT: The name “ack” is a reference to the movie Mars Attacks, where the aliens continously say “ack ack ack”