Jethro's Braindump

Python Import Resolution

Say you have a Python import statement:

import abc

Python will look up the following in order:

  1. sys.modules: this is the cache containing previously imported modules
  2. built-in modules
  3. sys.path: Usually includes the current directory