Remotely Execute Code in Maya using PyCharm


Previously, this process involved a lengthy walk through of copying scripts to various places across PyCharm and Maya.  Thankfully, there is now an all-in-one plugin available.  The steps below will echo the available instructions included with the plugin.  But this was one of the more popular pages on my site so I thought I would keep it current.



Chris Cunningham is the author of this plugin and all credit, as well as my sincere thanks, go to him for its creation.  This plugin has made the process of working across Maya and PyCharm unbelievably simple.

Github - LinkedIn


Installing MayaCharm


Installing the PyCharm Plugin

From PyCharm's settings panel, accessed via File > Settings and selecting Plugins on the left side of the window.  Next, type MayaCharm into the plugin finder field.  Click Search in Repositories as you will need to download it from Jetbrain's repository.  The next window that pops up should have MayaCharm already selected.  Choose Install and Restart PyCharm to complete the installation.



After Restarting PyCharm

Once PyCharm has reopened, access the settings again via File > Settings.  On the left hand side you should now see a MayaCharm listed towards the bottom.  This window allows you to configure the Host Name of the machine, as well as the Port Number which will be used by Maya.  I left these at their default values.



Configuring MayaCharm

One optional step that you may want to do is tweak the hotkeys used by the plugin.  The defaults for sending either a selected piece of code, or the entire documents, is mapped to Alt+A and Alt+S.  You can find these Shortcuts in File > Settings, and in Keymap on the left.  Search for MayaCharm and you should see them in the hotkeys list.



Connecting to Maya

In a previous step, we looked at MayaCharm's settings, located in File > Settings > MayaCharm.  Return to this section and below the Host Name and Port fields you will find a small snippit of Python code for opening a Maya Command Port.  Select this code and in Maya, add it to your, or optionally, turn it into a shelf button for easy access.

import maya.cmds as cmds
if not cmds.commandPort(':4434', query=True):


That's it!

Once you have opened a command port in Maya, highlight some code and hit the Hotkey you have bound and Maya will silently execute the command.  


Be sure to visit the Github page as MayaCharm has some additional capabilities that I don't describe here.

MayaCharm's GitHub