I’m trying to speed up my extension and thinking about setting it to rocket_mode_compatible.
Is this chatgpt answer correct, do i have to make sure to fix all my scripts to never have this on top? Or only for lib scripts as the “shared module” hint implies?
Caching ActiveView at import time
This is extremely common:
from pyrevit import revit
doc = revit.doc
view = doc.ActiveView
If that’s at the top of a shared module → Rocket Mode will bite you.
Best Practice Pattern for Rocket Mode
Instead of:
doc = revit.doc
Do this everywhere:
from pyrevit import revit
def get_doc():
return revit.doc
Don’t forget you can do Ctrl + Alt + Shift + Click on your pyRevit button to force it to reload the libraries. Not good for production, but it has saved me in development many times.
I’m probably stuck in the past, but this snippet has always worked for me to avoid Rocket Mode issues:
from pyrevit import HOST_APP
uidoc = HOST_APP.uiapp.ActiveUIDocument
doc = uidoc.Document
I want to move a bunch of my modeless windows to dockable panes - do i have to look out for anything in regards to rocket mode? If i want to clean the engine or anything crashes hard, just do the same keyboard shortcut to reopen it?