(Feb-13-2020, 02:16 PM)DeaD_EyE Wrote: In your modules, you call the functionbeginSending()
and in the otherbeginRec()
.
Don't do this. Remove the call from both modules or use the boilerpate code:
Hey, thanks for pointing that out. I had the 'beginRec()' and 'beginSending()' calls at the bottom from when I was creating each module, and running the modules themselves 'as main' for testing... I guess I just never removed them... but I didn't think it would cause any harm. I will remove them and see what happens.
I created a simple, reproducible test to test out the multiprocessing implementation, and it works as expected:
main.py
from func1 import runMe from func2 import runMeToo import multiprocessing def func1(): runMe() def func2(): runMeToo() if __name__ == "__main__": first = multiprocessing.Process(name='first', target=func1) second = multiprocessing.Process(name='second', target=func2) first.start() second.start()func1
import time def runMe(): while True: print("function 1!") time.sleep(1)func2
import time def runMeToo(): while True: print("function 2!") time.sleep(.5)output:
Quote:> function 1!
> function 2!
> function 2!
> function 1!
... etc.
However, Ideally I would like a solution that simply kicks off both 'processes' in completely separate terminal shells. Each of my modules produce output that is important, but unrelated to the other module's function, so I would like to keep their outputs separated amongst two different terminal windows. How can I code something to simple kick off each module independently in seperate terminals?