This document shows an example to share state between processes using Value and Array from multiprocessing library:
from multi
To communicate in a thread-safe manner you can use Queue. The get() method blocks if the queue is empty, and waits until a new element is put():
from multiprocessing import Process, Queue
def f(q):
while True:
element = q.get()
print(element)
if __name__ == '__main__':
q = Queue()
p = Process(target=f, args=(q,))
p.start()
q.put([42, None, 'hello'])
p.join()