Intro to Pymel

What is PyMel?

PyMel is an implementation of Maya Python that is separate to Autodesk’s version. It is open source, and has been used (and proven) at a number of high profile studios.

Syntax-wise, it’s a lot more object oriented. If you’re familiar with MaxScript, then working with PyMel is very similar.

Nearly all properties and command pertaining to a node can be accessed through the node itself.

For Instance, with a single mesh selected, getting the position of the [0]-index vertex in world space is very clean:

Compared to standard Maya Python:

Installing PyMel

    1. Go to and download the latest version (bottom right corner)
    2. Unzip the file
    3. Go into the directory “pymel_master” and copy the directory “pymel” to your Maya script directory (e.g. ..\Documents\maya\_YOUR_MAYA_VERSION_\scripts)
    4. Start Maya
    5. Confirm it works by running the following in a Python tab in the Script Editor

If you get no errors, we’re all good! If you DO get errors, make sure your path is ..\Documents\maya\MAYAVERSION\scripts\pymel

Basic Usage

Select all faces that point upwards:


Why do we call “pm.polyShpere[0]”? The reason is that the command “polySphere” is a wrapper for Maya’s “polySphere” command; which, like almost all commands in Maya that create a node, returns a list with both the transform and the node you created – in this case a mesh node. We only want one of them for PyMel’s purposes.

Node Properties/Methods

(Almost) every node in Maya has a PyMel version that’s tailored for it. This version is a custom class, and as such has it’s own properties and methods. These vary from node to node; for instance, the camera class won’t have a “verts” property.

By calling “dir(node_object)” we can query all the properties and methods bound to this class.

There are just over 200 publicly accessible properties or methods on the sphere’s “transform” node (private members begin with an underscore).

Let’s look at a couple of the public members.

For example:

If you’re new to programming or scripting, the concept of get/set may be new to you. Check out the Python Fundamentals for more info.

Another collection of super useful methods are the ones involving DAG hierarchies, avoiding a messy “listRelatives” command:

Creating a Pymel Node

Sometimes it can be useful to retrieve a Pymel object for a node that you don’t have selected, but you know the name of. You can do this via the “PyNode” function:

More Info

More info can be found here:

For a video intro, check out this Vimeo PyMel Introduction

 Previous: Python Fundamentals Next: Diving Into Pymel