path to load modules from - The module search path


There are several steps Python does when it searches for the location of a file to be imported, but the most important one is what we see on the next page in sys.path.
  1. The directory where the main script is located.
  2. The directories listed in PYTHONPATH environment variable.
  3. Directories of standard libraries.
  4. Directories listed in .pth files.
  5. The site-packages home of third-party extensions.