Python import: How a module name becomes a file on sys.path

Python import: How a module name becomes a file on sys.path

You import a Python module with the variable you’ll define, not a filename.

“import mymod” tells Python to find mymod.py in each dir in sys.path.

The first directory is ” (the empty string) — i.e., the directory where the program is running (i.e., not where it was defined).