title: What happens to imports when a new process is spawned?
body: <p>What happens to imported modules variables when a new process is spawned?</p>
  
  <p>IE</p>
  
  <pre><code>with concurrent.futures.ProcessPoolExecutor(max_workers=settings.MAX_PROCESSES) as executor:
      for stuff in executor.map(foo, paths):
  </code></pre>
  
  <p>where:</p>
  
  <pre><code>  def foo(str):
    x = someOtherModule.fooBar()
  </code></pre>
  
  <p>where foobar is accessing things declared at the start of someOtherModule:</p>
  
  <p>someOtherModule.py:</p>
  
  <pre><code> myHat='green'
   def fooBar():
     return myHat
  </code></pre>
  
  <p>Specifically, I have a module (called Y) that has a py4j gateway initialized at the top, outside of any function. In module X I'm loading several files at once, and the function that sorts through the data after loading uses a function in Y which in turn uses the gateway. </p>
  
  <p>Is this design pythonic?
  Should I be importing my Y module after each new process is spawned? OR is there a better way to do this?</p>