You can use sys.exit() to exit from the middle of the main function.
However, I would recommend not doing any logic there. Instead, put everything in a function, and call that from __main__ – then you can use return as normal.
You can use sys.exit() to exit from the middle of the main function.
However, I would recommend not doing any logic there. Instead, put everything in a function, and call that from __main__ – then you can use return as normal.