title: Subprocess.popen- How to only run one process at once
body: <p>I'm trying to add a speech output to my python script using text to speech synthesis. The python script basically detects objects within a camera feed and classifies what kind of object it is. I'm trying to get the speech output to say what object is being detected.
  The code that I used to get a speech output is below where object_name is the name of the object being detected:</p>
  <pre><code>subprocess.Popen([&quot;espeak&quot;,object_name])
  </code></pre>
  <p>I want there to be only output at a time, so only one object name is being spoken at once.The problem is that whenever multiple objects are detected at once, there are multiple speech outputs being spoken out at once depending on the number of objects being detected. This is because the code I added is in a for loop that continuously detects different objects, so the variable that I used called <strong>object_name</strong> is constantly changing. I don't know much about subprocess and Popen, but based on the research that I did, I'm guessing its because there are multiple child processes running at once, with each one giving one audio output for one object. So my question is, how do I make it so that there's only one child process running at once? Thanks in advance.</p>