0

My code looks like this:

File A:

import os
inputA = input("Input: ")
os.system('InputTest.py')

File B:

inputB = input("Input: ")  # <-- I want this to automatically get filled in with inputA
print(inputB)

I want to have the input variable from file A fill the input request in file B (in the terminal).

mkrieger1
  • 14,486
  • 4
  • 43
  • 54

2 Answers2

0

Not a direct answer, but why don't you use sys.argv? i.e.:

script A

import os, sys

inputA = input("Input: ")
os.system('python /full/path/to/InputTest.py ' + inputA )

script B (InputTest.py)

import sys

if len(sys.argv) > 1:
    print(sys.argv[1])
Pedro Lobito
  • 85,689
  • 29
  • 230
  • 253
-1

i'm not sure of what you want to do,but,if u need to connect 2 scripts,maybe you can use socket lib,and make client-server connection. Or,to thing a "different" solution,you can make a text file,where one script write and another script read. Another solution can be,when you get input,you can open other python file and send input with pyautogui lib.

E_net4 - Krabbe mit Hüten
  • 24,143
  • 12
  • 85
  • 121
Aegis
  • 21
  • 4