title: How can I open urls in separate browser windows using python’s web browser module?
body: <p>I’ve been trying to open multiple (30+) links but for website-specific reasons, after a certain amount of tabs have been opened, the open tabs start to crash. To fix this, I want to open some of my tabs in one browser window and the rest in a completely separate one. I want to accomplish this by using the webbrowser module and only the webbrowser module (for personal reasons). A possible solution is to use one browser (eg Firefox) for some of the tabs and then switch to another one (eg Chrome) for the rest but I don’t know how to do that...</p>
  <pre><code>import webbrowser
  import pyautogui
  import time
  
  def open_websites(url, tabs, delay):
      tabs_opened = 0
      while tabs_opened &lt; tabs:
          webbrowser.get().open_new_tab(url)
          pyautogui.moveTo(x=1267, y=572) #move mouse to button's coordinates
          time.sleep(delay)
          pyautogui.hotkey(&quot;ctrl&quot;, &quot;d&quot;, interval=0.05) #to click a button using shorcuts
          pyautogui.hotkey(&quot;ctrl&quot;, &quot;e&quot;, interval=0.05) #also to click a button using shorcuts
          time.sleep(3)
          pyautogui.click() #to click the button at the specied coordinates
          tabs_opened += 1
          if tabs_opened == 3:
              while tabs_opened &lt; tabs:
                  webbrowser.get(using=&quot;mozilla&quot;).open_new_tab(url)
                  pyautogui.moveTo(x=1267, y=572)
                  time.sleep(delay)
                  pyautogui.hotkey(&quot;ctrl&quot;, &quot;d&quot;, interval=0.05)
                  pyautogui.hotkey(&quot;ctrl&quot;, &quot;e&quot;, interval=0.05)
                  time.sleep(3)
                  pyautogui.click()
                  tabs_opened += 1
  
  
  open_websites(&quot;https://meet.google.com/ymj-cifg-fts&quot;, 6, 3)
  </code></pre>
  <p>Documentation of the webbrowser module:
  <a href="https://docs.python.org/3/library/webbrowser.html" rel="nofollow noreferrer">https://docs.python.org/3/library/webbrowser.html</a></p>