No module named .....


#1

Seems a bit inconsistant but I have placed a python script into my scripts folder but get the above mentioned error …“no module named…”

Is there a different directory that Maya will look for python scripts apart from the normal one for mel scripts, or do I need to set this up? How?

Thanks again.


#2

say you have a python scripts folder at “//nas/Content/bin/python”

first you need to put your python files into that folder then
you need to specify the python folder via sys.path command like this:

from pymel.core import *; #you can also just import sys if you dont use pymel
sys.path.append("//nas/Content/bin/python"); #this points to your modules

then simply import your modules:

import module

and you are ready to go.


#3

You can also declare an environment variable PYTHONPATH.


#4

Thanks guys I will try it both ways for familiarity.


#5

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.