In this section, we will turn our focus toward the standard Python modules and Python packages.
When you import any module, Python will first check whether there is a built-in module with the specified name. An example of a built-in module is the string module.
If no built-in module is found, the interpreter will look for a file with the name of the module and the .py extension in the directories given by the sys.path variable. This variable is simply a list of strings which specifies where to search for modules.
How this variable is built is beyond the scope of this book. However, it is partly dependent on your defined PYTHONPATH and can be modified if necessary. You can read more about it in the Python documentation at https://docs.python.org/3/library/sys.html#sys.path.
For your interest, though, you can inspect the sys.path in your current environment by running the following commands on your terminal:
>>> import sys >>> sys.path...