For making one of my tools easier to work with, I’ve divided it into different files for each class. they are all in the same folder
Python documentation states:
When a module named spam is imported, the interpreter searches for a file named spam.py in the directory containing the input script
and then in the list of directories specified by the environment variable PYTHONPATH.
but when i try to import my different files as modules inside of motionbuilder, it fails:
ImportError: No module named baseClass
trying to do os.getcwd() to make sure i’m in the same folder as the script, it returns the correct folder.
I don’t want to add the folder to my PATH env variable just to import it.
I also had trouble importing modules from the same folder as the script I was running. The usual methods to find out what the directory of the script you are running is, did not seem to work.
To avoid explicitly defining that path to our python script folders in each and every one of our modules, we just sys.path.append() them to the python path, in a module that’s sits in the python startup folder.
The current working directory is not used at all for imports. Nor is the Windows system or user paths (except when binary modules load DLLs they’re dependent on, but that’s another story).
As the docs you quoted state, it looks in the folder where the script (doing the importing) sits, then searches down the folders in sys.path.
That all said, sounds like Mobo isn’t playing by the usual Python import rules for some reason.