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 requested to stop by the user. Once the process has started, I would like to update one of the local variables inside the parallel process from the parent program without stopping the process. For a very simple example, the parallel process I would like to execute would be the following:
import time
def loop(i):
while 1:
print i
i+=1
time.sleep(1)
Which continuously iterates and updates i. For clarity the parent program will contain:
from multiprocessing import Process
from loop import loop
i = 1
p = Process(target = loop, args = (i))
p.start()
From the parent program, once "loop" has be initiated, I would like to be able to change the input "i" to another number and have loop continue to iterate given the next starting value. If anybody has any ideas on how to do this, it would be greatly appreciated.