pobj = sp.Popen('sp.py', stdin=sp.PIPE, stdout=sp.PIPE, shell=True)
q = Queue()
t = Thread(target=getabit, args=(pobj.stdout, q))
t.daemon = True
t.start()
while True:
    print('Sleep for 1 second...')
time.sleep(1)
print('Data received:' + getdata(q).decode())
if not t.isAlive():
    break
in_dat = eval(input('Your data to input:'))
pobj.stdin.write(bytes(in_dat, 'utf-8'))
pobj.stdin.write('\n')
pobj.stdin.flush()
How can I know whether my subprocess is waiting for my input ?(in python3)