title: Python run a Linux command and then leave the terminal to user
body: <p>I am writing a remote login script that should just run a command (log me in to a device via telnet or ssh) and then just leave the terminal to me.</p>
  <p>I tried <code>subrocess.Popen</code> module and for windows host I managed to achieve what I needed, the script opens putty or SecureCRT via a cmd command logging me in and then stops leaving the window to me.</p>
  <p>In Linux it's a little different though, I want the script to run a command in the terminal and then I should be able to continue working on the terminal myself. I tried <code>subrocess</code> with not much luck.</p>
  <p>I can achieve this with <code>pexpect.interact()</code> but it seems that it will be more efficient if after logging me in the python script stopped as it is not needed anymore, if it is possible of course.</p>