2009

Table Of Contents
Call MEL scripts from Python
Entering Python commands
Just like MEL, you can enter Python commands in the Command Line or the
Script Editor. The Command Line can only accept single line Python
commands, while the Script Editor provides a method to input multiple Python
commands and view the results.
The Script Editor displays a running history of executed commands and the
results of commands that Maya executes. You can copy most commands from
the history section of the Script Editor and paste them in the input section to
execute them. However, the results of Python commands are not echoed to
the Script Editor exactly like MEL.
For more information, see
To set up the Script Editor on page 598.
To type a Python command in the Script Editor
1 Select Window > General Editors > Script Editor.
2 Select a Python tab in the Script Editor.
3 Type the following command in the input section of the Script Editor
and execute it by pressing Enter on the numeric part of your keyboard,
or pressing Ctrl+Enter.
import maya.cmds as cmds
You now have access to Maya commands through the maya.cmds module.
NOTE This is how you load modules in Python. For more information about
other Python modules, see the online Python documentation.
By convention throughout the documentation and the Python command
reference, the maya.cmds module is renamed cmds, but you can rename
the module anything you like.
Entering Python commands | 645