How to exit a PythonScript?

Here the user interface:
if you press the CancelButton in the User-Interface the code enters line 611 (Dialog is shown)
here the SourceCode

nothing is working…the code will continue execution

THX for help Carsten

Hi Carsten,
you might try

        raise Exception( 'message' )


Oh yes, this is a solution. For me it is working.
Do you also have a solution for a quiet exit without message?

THX Carsten

HI Carsten,

you might put your code into a function (def) and then use return statement to get out.