I noticed that I can access functions and modules in a child process that were outside of the child process function/target. So I'm wondering when I create a child process in python does it copy everything from current process? Why is it I can access functions and imported modules that are outside the child target?
from multiprocessing import Process, Pipe
def test1():
return "hello"
def simpleChildProcess( childPipe ):
# simpleChildProcess can access test1 function
foo = test1()
childPipe.send( foo )
parentPipe, childPipe = Pipe()
childProcess = Process( target=simpleChildProcess, args=(childPipe,) )
childProcess.start()
print "Pipe Contains: %s" % parentPipe.recv()