Bill Judge
Bill Judge

Reputation: 23

How to call a python program from inside a python program?

I'm trying to call a python program from inside a program what do I use. I have a python file that checks a file name and if it's a certain file I want to run another program. Any suggestions on what to use.

Upvotes: 1

Views: 98

Answers (1)

coder
coder

Reputation: 137

You can use the os.system command.

    import os
    os.system('python my_file.py')

i got this from https://www.tutorialspoint.com/How-can-I-make-one-Python-file-run-another

Upvotes: 1

Related Questions