pySource command is equivalent to the builtin
directive with the difference that the contents of the file must be
Python source code instead of MEL code.
The argument passed to the
pySource command can be a full path or just
the name of a script. If only the script name is provided, then
pySource will attempt to locate the file in the same directories where
the source directive would try to locate MEL scripts (as specified by
$MAYA_SCRIPT_PATH variable). If the name or path is un-suffixed
then pySource will add a
".py" suffix before the search.
Before the file is executed the command changes into the directory where the file is located. This means local modules (or data files) can be imported without having to worry about the module search path. All files are executed in the same namespace, i.e. symbols created by one script are visible to subsequent scripts. This means, modules are only imported once. If you do modifications to a module you must reload it like this:
import mymod reload(mymod)