title: How do I get the same queue into differnet multiprocessing files?
body: <p>I see a lot of tutorials on how to use queues, but they always show them implemented in the same file. I'm trying to organize my code files well from the beginning because I anticipate the project to become very large. How do I get the queue that I initialize in my main file to import into the other function files?</p>
  <p>Here is my main file:</p>
  <pre><code>import multiprocessing
  import queue
  from data_handler import data_handler
  from get_info import get_memory_info
  from get_info import get_cpu_info
  
  
  if __name__ == '__main__':
  
      q = queue.Queue()
  
      getDataHandlerProcess = multiprocessing.Process(target=data_handler(q))
      getMemoryInfoProcess = multiprocessing.Process(target=get_memory_info(q))
      getCPUInfoProcess = multiprocessing.Process(target=get_cpu_info(q))
  
      getDataHandlerProcess.start()
      getMemoryInfoProcess.start()
      getCPUInfoProcess.start()
  
      print(&quot;DEBUG: All tasks successfully started.&quot;)
  </code></pre>
  <p>Here is my producer:</p>
  <pre><code>import psutil
  import struct
  import time
  from data_frame import build_frame
  
  
  def get_cpu_info(q):
      while True:
          cpu_string_data = bytes('', 'utf-8')
          cpu_times = psutil.cpu_percent(interval=0.0, percpu=True)
          for item in cpu_times:
              cpu_string_data = cpu_string_data + struct.pack('&lt;d',item)
          cpu_frame = build_frame(cpu_string_data, 0, 0, -1, -1)
          q.put(cpu_frame)
          print(cpu_frame)
          time.sleep(1.000)
  
  
  def get_memory_info(q):
      while True:
          memory_string_data = bytes('', 'utf-8')
          virtual_memory = psutil.virtual_memory()
          swap_memory = psutil.swap_memory()
          memory_info = list(virtual_memory+swap_memory)
          for item in memory_info:
              memory_string_data = memory_string_data + struct.pack('&lt;d',item)
          memory_frame = build_frame(memory_string_data, 0, 1, -1, -1)
          q.put(memory_frame)
          print(memory_frame)
          time.sleep(1.000)
  
  
  def get_disk_info(q):
      while True:
          disk_usage = psutil.disk_usage(&quot;/&quot;)
          disk_io_counters = psutil.disk_io_counters()
          time.sleep(1.000)
          print(disk_usage)
          print(disk_io_counters)
  
  
  def get_network_info(q):
      while True:
          net_io_counters = psutil.net_io_counters()
          time.sleep(1.000)
          print(net_io_counters)
  </code></pre>
  <p>And here is my consumer:</p>
  <pre><code>def data_handler(q):
      while True:
          next_element = q.get()
          print(next_element)
          print('Item received at data handler queue.')
  </code></pre>