title: Can I reconnect to the main window with PyWinAuto?
body: <p>I reach open browser, click in the button on the screen and click in the button of the pop up window without problems. The only problem is, when I close pop up window clicking the button &quot;Close Tor Browser&quot;, I can't reconnect with my previous window (the main and first window). Any tips??</p>
  <pre><code>from pywinauto.application import Application
  import time
  
  for i in range(0,2):
      try:
          for i in range(0,1):
              try:
                  app=Application(backend='uia').start('\...\firefox.exe')
                  app=Application(backend='uia').connect(title='Connect to Tor — Tor Browser',timeout=40)
                  time.sleep(5)
                  app.window(best_match='Dialog', top_level_only=True).child_window(best_match='Ver todos los servicios').click()
  
              except Exception:
                  time.sleep(1)
                  app2=Application(backend='uia').connect(title='Close Tor Browser',timeout=40)
                  app2.window(best_match='Dialog', top_level_only=True).child_window(best_match='Cancel').click()
                  
          time.sleep(5)
          app=Application(backend='uia').connect(title='Connect to Tor — Tor Browser',timeout=40)   
          top_level_only=True).child_window(best_match='Ver todos los servicios').click()
          time.sleep(10)
          app.kill()
          time.sleep(1)
  
      except Exception:
          pass
  
  </code></pre>
  <p>I can open browser easily, click in the button on the screen and click in the button of the pop up window without problems. The only problem is, when I close pop up window clicking the button &quot;Close Tor Browser&quot;, I can't reconnect with my previous window (the main and first window). Any tips??</p>