I run this python file to spawn a process:
import os
import pwd
import subprocess
import sys
p = subprocess.Popen(['python', 'process_script.py'],
                     cwd="/execute",
                     stdout=subprocess.PIPE,
                     stderr=subprocess.STDOUT)
process_script.py looks like this:
import time
import random
import string
import helper
#
def run():
    while True:
        filename = "/execute/" + "".join([random.choice(string.ascii_letters) for j in range(8)]) + ".txt"
        helper.execute(f"echo foo > {filename}")
        time.sleep(10)
#
run()
[EDIT] In fact ps shows no other processess, so it looks like the thread terminates... but how and why?
If I run process_script.py directly, the files are created.