code: def find_window(self):
          
          window = self.app.activeWindow()
  
          while True:
              parent_window = window.parent()
              if parent_window:
                  window = parent_window
              else:
                  break
  
          return window
docs: Get top window in host