Reputation: 171
i have two script--script1.py and script2.py. Now i want to call script1.py with in script2.py. algo will be like this--
IF condition: run script1.py #through command line ELSE : exit
Upvotes: 3
Views: 320
Reputation: 473803
In script1.py
place this:
def main():
do something
if __name__ == "__main__":
main()
In script2.py
:
import script1
if condition:
script1.main()
Upvotes: 2