Problem:
I want to access the python interpreter from python code, and run commands in it. Currently i (naively) do the following:
import os
os.system("python3") # open the python interpreter
os.system("Hello World!") # print Hello World! via interpreter
However, when this code is run the following happens in the command line: the python interpreter starts but does not print "Hello World!" yet, because it sees Hello World! as a separate command that gets executed in the command line and not in the interpreter.
Question:
How do i make "Hello World!" print in the interpreter directly via python?