Skip to content

Instantly share code, notes, and snippets.

@esnosy
Last active January 6, 2022 12:13
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esnosy/42c204c2755a44162445f015f2c372d3 to your computer and use it in GitHub Desktop.
Save esnosy/42c204c2755a44162445f015f2c372d3 to your computer and use it in GitHub Desktop.
Clean Blender addon modules
# Based on https://devtalk.blender.org/t/plugin-hot-reload-by-cleaning-sys-modules/20040
def cleanse_modules():
"""search for your plugin modules in blender python sys.modules and remove them"""
for module_name in list(sys.modules.keys()):
if module_name.startswith(__name__):
del sys.modules[module_name]
# example usage
# in your very top module
# def unregister():
# # your unregister code
# cleanse_modules()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment