Hi there,
I have multiple *.py files that I need to run concurrently. Each file looks like this:
I have multiple *.py files that I need to run concurrently. Each file looks like this:
def my_function(file):
# my codeThen I have written this to run my files simultaneously:import multiprocessing
from file1 import my_function
if __name__ == '__main__':
__spec__ = "ModuleSpec(name='builtins', loader=<class '_frozen_importlib.BuiltinImporter'>)" # This line is because I am using Spyder as my IDE
files = ["path/to/file1.py","path/to/file2.py","path/to/file3.py","path/to/file4.py","path/to/file5.py"]
for item in files:
p = multiprocessing.Process(target=my_function, args=(item,))
p.start()
p.join()
print("Done!")The issue is that, however, the files are still being run one after another like in a sequence but not in parallel! Do you have any ideas how I may run my files concurrently?
