Using Wing with Autodesk Maya

Index of All Documentation » How-Tos » How-Tos for Modeling, Rendering, and Compositing Systems »


Wing is a Python IDE that can be used to develop, test, and debug Python code written for Autodesk Maya, a commercial 3D modeling application. Two versions of Wing are appropriate for use with this document: Wing Pro is the full-featured Python IDE for professional programmers, and Wing Personal is a free alternative with reduced feature set.

If you do not already have Wing installed, download it now.

This document describes how to configure Wing for Maya. To get started using Wing as your Python IDE, please refer to the tutorial in Wing's Help menu or read the Quickstart Guide.

Debugging Setup

When debugging Python code running under Maya, the debug process is initiated from outside of Wing, and must connect to the IDE. This is done with wingdbstub according to the instructions in the Debugging Externally Launched Code section of the manual.

Because of how Maya sets up the interpreter, be sure to set kEmbedded=1 in your copy of wingdbstub.py and use the debugger API to ensure the debugger is connected to the IDE before any other code executes as follows:

import wingdbstub
wingdbstub.Ensure()

Then click on the bug icon in lower left of Wing's window and make sure that Accept Debug Connections is checked. After that, you should be able to reach breakpoints by causing the scripts to be invoked from Maya.

In some cases you may need to edit wingdbstub.py to set WINGHOME to point to the directory where Wing is installed. This is usually set up automatically by Wing's installer, but won't be if you are using the .zip installation of Wing. Note that if you edit wingdbstub.py after Maya has already imported it then you will need to restart Maya to get it to import the modified wingdbstub.

To use the mayapy executable found in the Maya application directory to run Wing's Python Shell tool and to debug standalone Python scripts, enter the full path of the mayapy file (mayapy.exe on Windows) in the Python Executable field of the Project Properties dialog.

Better Static Auto-completion

At least in some versions of Maya, Wing cannot statically analyze the files in the Python API without some additional configuration. As a result, it will fail to offer auto-completion for the API. The solution to this depends on the version of Maya.

Maya 2016

Maya 2016 is missing necessary developer files so you will need to download and install the Maya 2016 devkit which should create devkit\other\pymel\extras\completion\py\maya\api in your Maya installation. This can then be used by making the following edits:

In "OpenMaya.py" add "from _OpenMaya_py2 import *"
In "OpenMayaAnim.py" add "from _OpenMayaAnim_py2 import *"
In "OpenMayaRender.py" add "from _OpenMayaRender_py2 import *"
In "OpenMayaUI.py" and "from _OpenMayaUI_py2 import *"

This method is based on this forum post.

Instead of editing files in the Maya installation, it is also be possible to add .pi files with the added source. For example, placing OpenMaya.pi with contents from _OpenMaya_py2 import * in the same directory as OpenMaya.py causes Wing to merge the analysis of the *.pi file with what is found in the *.py file.

Alternatively, place these files in another directory that is added to the Source Analysis > Advanced > Interface File Path preference in Wing.

You will also want to set the Python Executable in Wing's Project Properties to mayapy.exe so that the API is on the Python Path and you are using the correct version of Python.

Maya 2011+

Maya 2011+ ships with .pi files in the devkit/pymel/extras/completion/pi subdirectory of the Maya 2011 install directory. This can be added to the Source Analysis > Advanced > Interface File Path preference in Wing.

Older Versions

For older Maya versions, .pi files from the PyMEL distribution at http://code.google.com/p/pymel/ may be used. Just unpack the distribution and add extras/completion/pi to the Source Analysis > Advanced > Interface File Path preference in Wing.

Additional Information

Some additional information about using Wing with Maya can be found in For Python: Maya 'Script Editor' Style IDE. This includes extension scripts for more closely integrating Wing Pro and Maya and some additional details. For example, sending Python and MEL code to Maya from Wing is explained here

See also the section Using Wing with Maya in Autodesk Maya Online Help: Tips and tricks for scripters new to Python.

Related Documents

Wing provides many other options and tools. For more information: