Mahin Ra Mahin Ra - 1 month ago 8
Python Question

run two python files in parallel from terminal

If I have two python programs called test1.py and test2.py, How can I run them in parallel in terminal?
Does



python test1.py|python test2.py





do that?

Answer

No, this will pipe the output from test1.py into test2.py.

Use this instead: python test1.py &; python test2.py &

The & will fork the command into its own process.