Search Path for Modules
Do you know how an interpreter works when a module is imported? When a module is imported the interpreter looks at the current directory for the file name. If its not in the current directory it looks into the list of directories specified by the environment variable PYTHONPATH. This is similar to the shell variable PATH. If PYTHONPATH is not set the interpreter looks at an installation dependent default path. In most cases the default path will be ‘.:usr/local/lib/python’.
We can modify the path as follows:
>>> import sys
the new path must be given in position of ‘path’.