When a module is imported in Python, the following happens behind the scenes:
It starts with searching for mod.py in a list of directories which have been gathered from the following sources:

  • The original directory from where the input script was actually being run or in the current list if the interpreter is being run interactively side by side.
  • List of the directories within the PYTHONPATH environment variable, if it is actually set.
  • A directory list from the installed directories would have been configured at the time of installation of Python itself.

Note: After learning the basics of Python, if you are looking for what more to learn, you can start with meta-programming, buffering protocols, iterator protocols, and much more. We have created a list of Python Interview Questions for Experienced professionals to help them use this language to solve complex problems.

BY Best Interview Question ON 11 Jun 2020