I would like to pass a byte-object from file A.py to B.py where it is incremented by 1 and then passed back. Currently I have the following code and whenever I run python A.py, the program does not print anything. I feel like the problem is in file B.py though I am not sure.
A.py
import subprocess
import struct
door = subprocess.Popen(['python','B.py'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
door.stdin.write(struct.pack(">B", 0))
door.stdin.flush()
print(struct.unpack(">B", door.stdout.read()))
B.py
import sys
import struct
my_input = sys.stdin.buffer.read()
nbr = struct.unpack(">B", my_input)
sys.stdout.buffer.write(struct.pack(">B",nbr+1))
sys.stdout.buffer.flush()

