Q: How can I determine the method used to launch my python script in Windows? Is there a way to differentiate between a .py file launched by double-clicking its icon in Windows versus typing myscript.py in an existing command prompt window? My code ends with os.system("pause") so that I can see the results when double-clicking to launch, but that line should be ignored when running it in a persistent window.

A: I would first recommend you to go to advanced settings of your Windows Explorer and activate the "show extensions" options if that can help. 
For more information about your question, you can also check this link :
https://automatetheboringstuff.com/appendixb/
