I am relatively new to programming, and what I am asking might be a task that is not possible. What I want to do is start a parallel process, which will continuously run until
You can use a queue to pass data between the processes:
from multiprocessing import Process, Queue
from loop import loop
i = 1
q = Queue()
q.put(i)
p = Process(target=loop, args=(q, ))
p.start()
Whenever you want to transmit a new value of i to the other process, just put it in the queue.
Change your loop.py module accordingly:
def loop(q):
while True:
i = q.get()
print i
In your main code, you can put new values for the process:
while True:
i+=1
q.put(i)
time.sleep(1)