import subprocess
import os 
m_list = ['complex', 'random', 'random2']
path = os.getcwd()
print(path)

processes = []
for seed in range(6):
    for mode in m_list:
        # subprocess.run(["chmod", "+x", script_path])  # This makes the script executable
        output_file = 'results/util_mode/%s_seed%s-%s.out'%(mode, seed*10, seed*10+9)
        with open(output_file, 'w') as f:
            # Start each script in a new subprocess with nohup and redirect the output
            p = subprocess.Popen(['nohup', 'python', 'run_util_mode.py', '%s'%mode, '%s'%seed], stdout=f)
            processes.append(p)

for p in processes:
    p.wait()