title: How to open a new console from python script and be able to manage it
body: <p>I am writing a script that needs to be able to open a separate console window and read and write to it(on Windows). I want to use telnet and ssh from new consoles and the main console use as a manager</p>
  
  <p>Right now i was trying thoes things:</p>
  
  <p><strong>main file</strong></p>
  
  <pre><code>import subprocess as sp
  from getpass import getpass
  import telnetlib
  import multiprocessing as mp
  import os
  
  def run(command):
      cmd = sp.Popen(command.split(), sp.PIPE)
      com, err = cmd.communicate()
      print(com,err)
  
  if __name__ == "__main__":
      login = input("Podaj login: ")
      password = getpass()
  
      ip = "10.74.119.252"
      command = f"python LogInConsol.py {ip} {login} {password}"
  
      process = mp.Process(target=run, args= (command,))
      process.start()
  </code></pre>
  
  <p><strong>LogInConsol file</strong></p>
  
  <pre><code>import telnetlib
  import subprocess as sb
  import sys
  
  argv = sys.argv
  ip = argv[1]
  login = argv[2]
  pw = argv[3]
  
  # tn = telnetlib.Telnet(host=ip, port= 23)
  # tn.read_until(b"login: ")
  command = f"cmd.exe start /k telnet {ip}"
  cmd = sb.run(command.split(),sb.PIPE)
  com, err = cmd.communicate()
  </code></pre>
  
  <p>But the behavior is such that everything happens in main consol window(from which i start program)</p>
  
  <p><strong><em>UPDATE</em></strong></p>
  
  <p>This started to work as i wanted it to.</p>
  
  <p><strong>Main.py</strong></p>
  
  <pre><code>from subprocess import Popen, PIPE, CREATE_NEW_CONSOLE
  from getpass import getpass
  import telnetlib
  import multiprocessing as mp
  import threading as th
  
  def run(command):
      cmd = Popen(command, PIPE, creationflags=CREATE_NEW_CONSOLE)
      com, err = cmd.communicate()
      print(com,err)
  if __name__ == "__main__":
      mp.freeze_support()
      login = input("Podaj login: ")
      password = getpass()
      ip = "10.10.10.10"
      command = f"python LogInConsol.py {ip} {login} {password}"
      process = mp.Process(target=run, args= (command,))
      process.start()
      input("Wait ")
  </code></pre>
  
  <p><strong>LogInConsol.py</strong></p>
  
  <pre><code>import telnetlib
  import subprocess as sp
  import sys
  
  
  argv = sys.argv
  ip = argv[1]
  login = argv[2]
  pw = argv[3]
  
  
  print(argv)
  tn = telnetlib.Telnet(host=ip,port=23)
  red = tn.read_until(b"username: ")
  print(red)
  </code></pre>