Setup Visual Studio to write python code for Maya in 5 steps

1

Instal the Python Tools for Visual Studio. This is a free plugin that turns Visual Studio into a python IDE. If you don’t want to pay for VS, you can install the free PTVS integrated version (at the bottom of the downloads).
- Create a new Python Project in VS. Open the properties of your project.
- You can also put in the Interpreter Path for the standalone setup:C:\Program Files\Autodesk\Maya2014\bin\mayapy.exe

2

You can Debug your python code by clicking Attach to Process under the Debug menu. Choose for the maya.exe. This works for me in Maya2013 and Maya2014.

3

For fast script execution I wrote a plugin for Visual Studio 2013 called ToMaya. With this plugin you can easily execute your python script directly in Maya.

4

Maya python command completion. Add the the following paths to the search paths in your Solution Exlorer:

To get all your modules with Intellisense working right? I can get pymel command completion working (though it’s extremely wonky with some methods missing like pm.xform, translate etc.), but not maya.mel or maya.cmds, among others.

Hi, I tried your methods for Maya2015 and they didn’t work, your VS plug-in “ToMaya” works fine, but in VS, I don’t have the python command completion, and VS cannot recognize the Maya python commands.

Thanks for trying out. What version are you using of visual studio?
For the command completion make sure you have the search path set up. C:\Program Files\Autodesk\Maya2014\devkit\other\pymel\extras\completion\py\maya and make sure you do the import statement (import maya.cmds as cmds; cmds…)
Let me know!

I’ve set up the search paths and am able to see maya.cmds when I import, but after that none of the completion works. For example I can do “import maya.cmds as cmds” but then “cmds….” doesn’t have any completion. Any tips?

Also can you speak to how necessary it is to set up a “python environment” in the project? I’ve currently set one up for mayapy.exe