Exiting a callback

Out of curiosity is there a protocol for exiting a callback without triggering any other callbacks chained to the current one?

For example if there is no new data and you want to skip the callbacks that refresh your plots.


This thread seems to be very similar to what you’re trying to work on

You can raise an exception inside your function.

Here’s where this happens in the code: Any non-200 level will then be ignored by dash’s front-end: dash-renderer/index.js at 9992d73303492671d9619c161b9184d35f43faf6 · plotly/dash-renderer · GitHub

1 Like

Thanks @rad - I think that thread’s more concerning cacheing callbacks than exiting though.

Thank you @chriddyp that looks like it could be the best solution


Follow up question: Does this have to be a specific error or any kind? And I just invoke one within the callback function?

Any uncaught exception will work. We recommend the dash.exceptions.PreventUpdate() exception, see here: Improving handling of aborted callbacks - #2 by chriddyp


Superb, thank you very much. :slight_smile: