Command plug-ins define new custom MEL commands, and correspondingly add functions to the maya.cmds Python module for use in scripting. OpenMayaMPx.MPxCommand is the base class from which your custom Commands will derive. A trivial example of a command plug-in is presented in , which creates the spHelloWorld command. This command is invoked in the Maya Script Editor in one of two ways:
import maya.cmds as cmds cmds.spHelloWorld()
Running this command prints "Hello World" to the Script Editor output. More useful commands can be defined to query the scene, and to automate the manipulation of various scene elements. Command plug-ins can also be paired with to facilitate the creation and connection of custom node types.