title: How to share an object between processes?
body: <p>I'm working on a program that has 2-3 different 'processes' or 'workflows' that all need to execute at once (not necessarily in parallel, they just all need to run at the same time). These processes run and function on their own independently to perform different but related tasks, but they also need to share a few objects (lists and vars). </p>
  
  <p>I'm wondering what's the best way to implement this? To give some basic background info and context, this is a program to integrate an sms messaging platform with our CMS. The 3 modules are sender, receiver, and a module that reads and queues new outbound jobs called jobHandler. </p>
  
  <p>I got each module working fine, but my problem lies in tying them all together. I implemented multiprocessing but found trouble when I realized I would have to share objects across both different modules and different processes, which simply did not work. </p>
  
  <p>Is there a better way to do this that I'm completely missing? How would you implement something like this?</p>
  
  <p>This is python 3.6. </p>
  
  <p>Simplified example (all modules started up using multiprocessing), </p>
  
  <p>jobHandler:</p>
  
  <pre><code>import pyodbc
  
  q=[]
  
  def queueJobs():
      ~do stuff~
      x=new job
      q.append(x)
  </code></pre>
  
  <p>sender:</p>
  
  <pre><code>from jobHandler import q
  
  def send():
     ~do stuff~
      print(q)
  </code></pre>
  
  <p><code>q</code> will always show as <code>"[]"</code> when printed from sender. I realize this is because when the modules are all started with multiprocessing, <code>q</code> is empty. How can I share the current state of objects across different processes?</p>