1

I declared some function with multiprocessing but I'm unable to get the output/access of global variable declared within the function

import pandas as pd
import numpy as np
import multiprocessing
sym1=['x','y']
def func1(sym):         ##Thread one, fetching
   global ticks,sym4
   sym4=0
   ##and ticks are used for some computation in the function and sym4 remained unchanged

if __name__ == '__main__':
    with multiprocessing.Pool(processes=len(sym1)) as p:
         results = p.map(func1, sym1)

  • Checkout this post: https://stackoverflow.com/questions/11055303/multiprocessing-global-variable-updates-not-returned-to-parent/11056415#11056415 – pacuna Aug 25 '20 at 14:35

0 Answers0