I have a parent script that runs 10 child scripts. These scripts are identical apart from the 'name', each script calls a different api, saves to a different folder etc that depends on name.
I originally just copied the script 10 times however I now realise this is ridiculous as if I make one upgrade I have to do it to all 10.
I'm quite new to threading and am not sure if this is allowed, but can I set up a for loop or similar that calls the script and places the 'name' inside:
Ie
#parent.py
from threading import Thread
import sys
names = ['BTC', 'BTS', 'ETH', 'CLAM', 'DOGE', 'FCT', 'MAID', 'STR', 'XMR', 'XRP' ]
for name in names:
sys.path.append('/python/loanrates/'+name)
import name
Thread(target=name.main(name)).start()
Thread(target=name.main(name)).join()
joinin the loop, as it waits for your thread to finish and will block the start of other threads