I am trying to send a string from a program 1 to another program program 2, both in python 3
e.g.
#_____________________________________1.py
a = input('Type in a string: ')
# send somehow a string a from this program
# to the second program
I want to somehow send a string a
to my second program so it will print out a
:
#_____________________________________2.py
# receive somehow a string from the first
# program and store it in a
print(a)
How do I do this?
I am still a beginner programmer and would love it if you could help me.
1.py
2.py
.ANSWER:
I found a way to solve this.
import subprocess
username = input()
subprocess.Popen(['python.exe', 'file.py', username])
I found the answer.
import subprocess
username = input()
subprocess.Popen(['python.exe', 'file.py', username], subprocess.creationflags=CREATE_NEW_CONSOLE)