import os, subprocess, threading test = '' def main(): if not os.path.exists("nodes"): os.mkdir("nodes") os.chdir("nodes") for node_id in os.listdir(): t = threading.Thread(target=daemon, args=(node_id)) t.start() def daemon(node_id): with open(f"{node_id}.log") as f: subprocess.run(f"cd {node_id} && rnsd --config ./", shell=True, capture_output=True) if __name__ == "__main__": main()