By “the rest of the script”, you mean other code placed after prodigy.serve
? You could probably catch KeyboardInterrupt
, then execute your other logic and then terminate the process manually. Or you could just write your own logic that serves the app and includes hooks for starting and stopping – if you look at the app.py
, you’ll see that it’s really pretty straightforward and doesn’t need a lot of code.