Python: How to run a script1 from script2 and DUPLICATE script1's output (stdout, stderr) in script2 for logging (into a file)
<p>I have two python scripts: script1.py and script2.py</p>

<p>I want to run script1 from script2 (os.system, subprocess.Popen, ..) and then log script1's output (stdout, stderr) to a file log.txt, while still seeing script1's and script2's outputs on my terminal (as I would see, without the logging feature), as the are printed on ..</p>

<p>N.B.: It essential that log.txt exactly reflects the output (stdout, stderr) i would get on screen/terminal, corresponding to script1's run.</p>

<p>Thanks in advance for your kind help.</p>

<p>dOpP</p>
