I'm having a small yet quite annoying issue with Python. When I import the webbrowser module in a Python script that is run from IDLE, it works perfectly fine. However, if the script is run outside of IDLE, importing the webbrowser module makes the program stop and wait for user input.
I made the following basic example that shows the problem step by step:
print('the program has started')
print('importing some random modules')
import sys
print('sys imported')
import pyperclip
print('pyperclip imported')
import logging
print('logger imported')
print('this is the line before importing the webbrowser module')
import webbrowser
print('webbrowser module imported')
print('end of demo program')
Here is a screenshot of what happens when I launch the program. And finally, here is a screenshot of the program after I enter some text and press enter.
What is it that it stops the webbrowser module when importing it outside of IDLE? I only want the program to import the module and to continue normally.