""" How to launch a python script, the right way """ # This is a very short introduction into the correct way of launching a python script. # There's only 1 correct way of doing this, shown below. import os def main() -> None: print("Hello world!") if __name__ == "__main__": main() # In short a python script can be devided in 3 parts. # Imports, definitions, directly executable. # Only your main file should contain these 3 parts/sections. Any imported file should only contain the first 2 # parts. This prevents you from running a file that's only supposed to be imported, directly from terminal. # Your main file must follow this setup. Failing to do so, will give you issues further down the path. # The overall purpose of this setup is that the file you execute with python, is called "__main__" internally and # any other files is called by their import name. # No function/class method definitions are executed until you actually call the function/method.