What I need here is opening a python console from python script and then pass commands to that python console.
I need to automate this process. Currntly I am using os.system and subprocess to open the python console but after that I am totally stuck with passing print("Test")
to python console.
Here is the sample code which I am working on.
import os
os.system("python")
#os.system("print('Hello World'))
# or
import subprocess
subprocess.run("python", shell = True)
Please help me to understand how I can pass the nested commands. Thanks