Go to: Synopsis. Return value.
python(
pythonString
)
python is undoable, queryable, and editable.
This command may be used to execute Python scripts from MEL. The command is passed a string containing a snippet of Python code. That code is then executed and the result in resturned to MEL. Note that only single-line Python scripts will return a result due to a limitation in the Python interpreter. The return type from the Python code will be converted into a MEL type. Python integer, float, and string return values will be converted into the match MEL types. As well, if the Python code returns a list, the python command will try to determine if it could be converted into a MEL array. MEL arrays of ints, floats, and strings are supported. If none of these conversions are possible, then Python will return the string representation of the returned object.