Last active
January 6, 2022 12:13
-
-
Save esnosy/42c204c2755a44162445f015f2c372d3 to your computer and use it in GitHub Desktop.
Clean Blender addon modules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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