Skip to main content


How can I make one Python file run another?

Run Python Script inside another Python Script



This is one method where you can run one python script inside another python script. Using this process you can add as many functions as you want and call your functions using the second, third, or more scripts. Watch the video for better understanding.


Save it as script1.py
#script1.py
def helo():
     return "hello world"

def heloo():
     return "ya i said it"

def helooo():
     return "oh thats it"

def heloooo():
     return "time for a nap"

Save it as script2.py
#script2.py
import script1

try:
     print(script1.helo())
except AttributeError:
     print("No such Function born")


Comments



🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍

Popular Posts

Python underline string, Python underline text, Underline python print

Python pip - Installing modules from IDLE (Pyton GUI) for python 3.7

Top 40 Python - String Processing in Python | Working with String in Python

Top 11 Essential Python Tips and Tricks

Python Program - When was I born? / Date of Birth / MY BIRTHDAY (using Python3+)





Subscribe to our Channel


Follow us on Facebook Page

Join our python facebook groups



Join us on Telegram