title: How can I remove duplicates while multiprocesscing?
body: <p>I am very new to multiprocessing and I am only using it to find an image on the screen, the problem is the code produces duplicates which slow it down I have tried using a &quot;not in&quot; statement to only place proc into processes if it is not already in it, but this did not work. Any help or optimization would be welcome I have no idea what I am doing as this is just a personal project to learn multiprocessing.</p>
  <pre><code>from multiprocessing.context import Process
  import pyautogui as auto
  screenWidth, screenHeight = auto.size()
  currentMouseX, currentMouseY = auto.position()
  def bot(aim):
      while True:
          for aim in auto.locateAllOnScreen(r&quot;dot.png&quot;, confidence=0.9795):
              auto.click(aim)
              print(aim)
  def bot2(aim):
      while True:
          for aim in auto.locateAllOnScreen(r&quot;dot.png&quot;, confidence=0.9795):
              auto.click(aim)
              print(aim)
  def bot3(aim):
      while True:
          for aim in auto.locateAllOnScreen(r&quot;dot.png&quot;, confidence=0.9795):
              auto.click(aim)
              print(aim)            
              
  if __name__ == &quot;__main__&quot;:
      processes = []
      for t in auto.locateAllOnScreen(r&quot;dot.png&quot;, confidence=0.9795):
          proc = Process(target=bot, args=(t,))    
          processes.append(proc)
          proc.start()
      for z in auto.locateAllOnScreen(r&quot;dot.png&quot;, confidence=0.9795):
          proc = Process(target=bot2, args=(z,))    
          processes.append(proc)
          proc.start()
      for x in auto.locateAllOnScreen(r&quot;dot.png&quot;, confidence=0.9795):    
          proc = Process(target=bot3, args=(x,))    
          processes.append(proc)
          proc.start()
      for p in processes:
          p.join()
  </code></pre>