title: Executing the next line of code after subprocess.popen
body: <p>I am executing Tcpdump command using Popen. In my code, the popen line runs but it does not execute the next line of code following the popen line of code. Why is it happening and how can I solve this ? Thanks.</p>
  
  <pre><code>from subprocess import Popen, PIPE
  import os
  import time
  
  pw ='12345678'
  process = Popen(['sudo', '-S', 'tcpdump', '-i', 'wlp1s0', 'udp', 'port 8308', '-w', 'trace.pcap'], stdout=PIPE,universal_newlines=True,stdin=PIPE)
  process.communicate(pw + '\n')[1]
  print("Command ran")
  time.sleep(3)
  </code></pre>
  
  <p>Here the "Command ran" is not printed.</p>