Stop a script with code? Sometimes I have a big script and I want to do some tests without it running until the end. I'd like to add a lign of code to terminate the script where I want it without closing blender.

I've found this code online but it quit Blender, which is not what I want, I'd like the equivalent of a CTRL+C in the console.

import sys
sys.exit()
Depending on what the rest of the code does (and whether it handles any exceptions) you could simply raise an exception with :

raise Exception(“I’ve just triggered termination of my script”)


If the code doesn’t specifically handle exceptions then this will terminate the processing and Blender will report the message raised in the exception.

Obviously, you can replace the text with your own, appropriate to the situation.