maya Maya Python Paths Using


Add arbitrary paths to the Maya Python environment in the file. is a Python file (not a module) which gets automatically executed on Maya startup. can live in a number of locations, depending on the os and environment variables.

When Maya starts, it will execute the contents of the userSetup file. Adding Python paths here will allow it to find modules:

 import sys

This will make Python module files in '/path/to/my/modules' available for import using the standard import directive.

For more advanced setups, the site module can do the same using the addsitedir() function. site.addsitedir() supports .pth files which configures multiple paths in one go.

For example, three folders of unrelated Python could be arranged like this:

  +---- studio
  |      +
  |      +
  +---- external
         +---- paid
         |      +
         +---- foss

Using sys.path directly you'd have to add python_files/studio, python_files/external/paid and python_files/external/paid manually. However you could add a .pth file to the root of python_files that looked like this:


and call this in userSetup:

 import site

and you'll get all of the paths in one go.