main.py
from multiprocessing.pool import Pool
from mod1 import func1
def worker(val):
global value
value = 121212
print(val)
func1()
func2()
...
...
pool = Pool(3)
pool.map(worker, [{1:100},{2:200},{3:300}])
pool.close()
pool.join()
mod1.py
def func1():
global value
print(value)
I have a main module wherein I have a worker function which calls multiple functions in a sequential manner. I would like each of these functions to share a read only global variable say "value". Is there any way to achieve this ?