Generator from function prints
问题 At the moment I have a little flask project that calls another python file. I'm fully aware that this way is kinda awful, and so, I want to swap it for a function call while maintaining the prints getting yelded to the website . def get_Checks(): root = request.url_root def func(): yield ("Inicio <br>") with subprocess.Popen(r"python somefile.py", stdout=subprocess.PIPE, bufsize=1, universal_newlines=True) as p: for line in p.stdout: yield (line + "<br>") return Response(func()) I've tryed to