I have three python scripts; one is a console application, one is a gui application, and one is the main application to run them.
I need a way to detect if the main script was run via directly opening it or via a command line interface, so it knows which script to launch.
Asked
Active
Viewed 23 times
0
Coolcreeper
- 144
- 8
-
Check the value of `sys.argv[0]` that represents the calling program: `import sys ; sys.argv[0]` – mozway Jan 17 '22 at 22:11