I have two processes that communicate via sockets. The first process first opens the second process in the following way:
def run_command(cmd)
subprocess.call(cmd, shell=True)
cmd = 'python full_path_to_script.py'
thread = Thread(target=run_command, args=(cmd,)
thread.start()
And then opens the connection:
from multiprocessing.connection import Client
address = ('localhost', port_number)
conn = Client(address, authkey=b'some_password')
When the first want to plot something, it sends a message to the second one, which decipher the message and plot the data using matplotlib. The idea is that the first message opens an image, and the other messages send updates to the image. The problem is that pyplot.show hangs the second process which now cannot get new messages. I tried to use pyplot.ion() but then the figure just got frozen (it didn't help to add pyplot.pause(0.001)).