Steps required to refer one python file in other python file
- Create two python files mymodule.py & myprogram.py based on the code given below
- Then execute python file - myprogram.py
mymodule.py
def my_func() :
print("Hey I am in mymodule.py")
myprogram.py
from mymodule import my_func
my_func()
Now to execute the python file myprogram.py
python3 myprogram.py
Output:
Hey I am in mymodule.py
Top comments (0)