Command Plug-in Basics

What is a Command Plug-in?

Command plug-ins define new custom MEL commands, and correspondingly add functions to the maya.cmds Python module for use in scripting. MPxCommand is the base class from which your custom Commands will derive. A trivial example of a command plug-in is presented in Your First Maya Python Plug-in, which creates the spHelloWorld (Python API 1.0) or pyHelloWorld (Python API 2.0) command. This command is invoked in the Maya Script Editor in one of two ways:

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 dependency graph plug-ins to facilitate the creation and connection of custom node types.