Importing and Running External Python Scripts in Maya 2011
When developing an external python script, it is often preferable to develop it in an external editor and source it through Maya. To speed up this workflow wouldn't it be nice to have a custom button on your shelf to be able to execute the external script? Here's how to do it:
Want to view a video tutorial on how to set this up? Check out this post instead.
Open up the script editor in Maya and create a new Python tab by going to Command -> New Tab... and choosing Python.
Thanks to this handy Python function I found on CGTalk, you can copy and paste this script into your Python tab in the Maya Script Editor. Then update the two instances of name_of_python_file and enter the full path of the directory holding your script.
Go to the file menu and choose Save Script to Shelf. Give the button a name and it will show up in the active shelf.
Now you can edit your external script, save it, click the button on the shelf and have your script re-loaded and executed.