Python no working on my pc

I have Python 3.14.2 installed on my Windows 11 system. Visual Studio opens and runs Python scripts fine, but whenever I try to open any .py file directly by double-clicking it, the window immediately closes. I’ve tried:

  • Reinstalling Python

  • Setting .py file associations with python.exe

  • Running assoc and ftype commands in CMD

  • Adding input() at the end of the scripts

  • Creating .bat scripts

Nothing seems to work. The scripts only run properly inside Visual Studio or another IDE.

Could you please help me fix this so that I can run Python scripts directly by double-clicking .py files on Windows?

This is as expected. What you can do if you want the original .py file to stay open as a stand alone file is to open IDLE, and open the file from there.