A quick question for Python 2.7
Are global variables visible to a subprocess?
Can a subprocess change the values of global variables?
Many thanks.
A quick question for Python 2.7
Are global variables visible to a subprocess?
Can a subprocess change the values of global variables?
Many thanks.
No, global variables are not visible to a sub-process. Variables are private to each process. If you want to share variables then you need to use some form of inter-process communication.
The processes doesn't share the variables in a general operating system
terms. Use some communication mechanism like message passing, shared memory etc to achieve the inter process communication.
Maybe the simplest way is write those into a file and read from the file in another process, although this might take extra time.