It looks like the entire file gets re-ran for each subprocess. In those processes, __name__
is no longer equal to '__main__'
but rather '__mp_main__'
. Therefore, the code which added all of the keys to the dictionary wasn't being run.
I'll change my program to explicitly pass the global variable to the function as an argument since, in my actual code, it's costly to compute.