Hi everyone,
I’m running into an issue with pyRevit hooks and wanted to ask if there’s a recommended way to disable or suspend them.
I have several hooks implemented (e.g. doc_changed, app_init, and a few others). Some of my scripts are getting triggered recursively, and because the hooks fire again during execution, the scripts end up failing or behaving unpredictably.
My questions are:
-
Is there a way to globally disable pyRevit hooks (temporarily or conditionally)?
-
Or is there a best practice for preventing hooks from re-triggering scripts that are already running?
-
For example, is there a built-in mechanism, context flag, or pattern to safely ignore hook execution during certain operations?
Any guidance, examples, or recommended patterns would be greatly appreciated.
Thanks in advance!