Sunday, August 15, 2010

Alternative Importing

Using Maya's scripts folder is great if your working on a personal project, but isn't as handy for a company wide script.  In these cases you can assign Maya to look in a shared folder.
import sys
sys.path.append("M:\mayascripts")
import HelloWorld

Whereas the MEL source command allows for absolute paths:
source "C:/users/paul/desktop/something.mel"
Or set the environment variables MAYA_SCRIPT_PATH for MEL and the PYTHONPATH for Python to the scripts directory.  Also note Maya will automatically source all your MEL files, but Python scripts must always be manually imported.

If you are going to be editing the env variables you will need to restart Maya for changes to take affect.