diff --git a/scripts/modules/bpy/utils/__init__.py b/scripts/modules/bpy/utils/__init__.py index da6aff8163e..f13feb12c12 100644 --- a/scripts/modules/bpy/utils/__init__.py +++ b/scripts/modules/bpy/utils/__init__.py @@ -285,6 +285,13 @@ def load_scripts(*, reload_scripts=False, refresh_scripts=False): del _global_loaded_modules[:] + # Update key-maps to account for operators no longer existing. + # Typically unloading operators would refresh the event system (such as disabling an add-on) + # however reloading scripts re-enable all add-ons immediately (which may inspect key-maps). + # For this reason it's important to update key-maps which will have been tagged to update. + # Without this, add-on register functions accessing key-map properties can crash, see: #111702. + _bpy.context.window_manager.keyconfigs.update() + from bpy_restrict_state import RestrictBlend with RestrictBlend():