To make the code behave similar on both Windows and Linux, pass b
explicitly:
Process(target=fb2, args=(k, b))
The difference is that on Linux fork
is used by default and it copies whatever state the parent process had to the child process. That is why the changes made inside fmt()
are visible in children.
Windows uses spawn
start method by default that reproduces the global state only partially e.g., values that are set during the import time are visible but changes made inside fmt()
are not.