How Do You Find Where the Python Interpreter Will Look for Modules?

Problem scenario
You want to use custom modules (e.g., .py files that will be called by another Python program). You are trying to figure out which location(s) the Python interpreter will look for such modules. How do you determine the directory where Python will look when it uses the "import" key word?

Run these three commands (the first is a Bash command and the other two are Python):

import sys

Leave a comment

Your email address will not be published. Required fields are marked *