I use this bit of code to start the server as a subprocess and put the stdout into a text file.
with open('serverlog.txt', 'w') as outfile:
proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=outfile, shell=False)
and then use this to send a commmand to the subprocess via the communicate method
if message.content[:5] == "++say":
userMessage = message.content[6:]
proc.communicate(input=f"say {userMessage}".encode())
but once this block of code is reached, the program hangs.