[Maya-Python] Re: execute string as script

2009-03-31 Thread ryant
In this example renderLayerNode is inside of foo's scope so you can not use that variable outside of it unless it is a global. I dont use pymel, I use Maya Python and it would look like this: def foo(): global renderLayerNode global scpt renderLayerNode = "foo" re

[Maya-Python] Re: execute string as script

2009-03-31 Thread King
Every thing is inside a function. def foo: renderLayerNode = PyNode( "deaultRenderLayer" ) scpt = node.myScript.get() Suppose script on string attribute on node is: print renderLayerNode.name() val = renderLayerNode.myAttrib.get() Using this: exec( scpt, globals() ) I get en error: #

[Maya-Python] Re: execute string as script

2009-03-31 Thread ryant
Can you give a more clear example of what you are wanting to do? You say external are you trying to print attributes from other modules? If so you need to import those modules and prefix the attributes with that modules name. # This works a = 1 b = 2 scpt = 'print a, b' exec( scpt, globals() ) #