I have been searching and every solution I find is for Windows specific. I am looking for a way to run multiple python programs at one time. I have tried
import test1
import test2
and i only get one of them at a time. I am needing both to be ran at the same time.
Any help is appreciated!
To run Python code in parallel, please refer to the module multiprocessing .
from multiprocessing import Process
def first_import():
import test1
def second_import():
import test2
if __name__ == '__main__':
first_process = Process(target=first_import)
second_process = Process(target=second_import)
first_process.start()
second_process.start()
first_process.join()
second_process.join()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.