import os import time session_char = 'esri' sub_dir = 'esri' web_arr = ["esri.com", "qgis.org", "arcgis.com", "esri.uk"] # web_arr = [ # "fwi.co.uk", # "nfuonline.com", # "gov.uk/defra", # "ahdb.org.uk", # "farmersguardian.com", # "farmbusiness.co.uk", # "farmads.co.uk", # "thescottishfarmer.co.uk", # "farminguk.com", # "agriland.co.uk", # "ukagriculture.com", # "farmtrader.co.uk", # "leafuk.org", # "fginsight.com", # "soilassociation.org", # "businesswales.gov.wales/farmingconnect", # "thefarmingforum.co.uk", # "aafarmer.co.uk", # "farmersclub.com", # "farm491.com" # ] for i in range(0, len(web_arr)): tmux_cmd = 'tmux new-session -d -s ' + session_char + str(i) os.system(tmux_cmd) tmux_cmd = f'tmux send-keys -t {session_char}{i} "cd publish_blogs_ai" Enter' os.system(tmux_cmd) tmux_cmd = f'tmux send-keys -t {session_char}{i} "python3.8 web_scrape.py {web_arr[i]} {sub_dir}" Enter' os.system(tmux_cmd) time.sleep(1)