2.5.3.1 Module Search Path and Package Structure
Python Programming
When you import a module in Python, the interpreter looks for it in a specific order. Let's explore each step with simple examples.
- 1.Current Directory: Python first checks the current directory where your script is located. Suppose you have a script named main. py in your folder along with a module helper. py.
Example: In helper.py:
def greet () :
return " As – Salaam Alaikum from helper.py!"In main.py:
import helper
message = helper