To reload a Blender Addon at the console type:
>>> bpy.ops.wm.addon_enable(module='your_module_name')
Note: under-the-hood Blender uses Python's imp.reload
to reload modules.
One of its caveats is that the module dictionary will not be replaced. Since that is where module globals are stored, this can lead to surprises (if expecting a pristine module state after reload).
As such, restarting Blender semi-frequently is still a good idea even when using console reloading during development.
Note that the imp.reload
behavior can also be used (with care) as a debug-enabling tool; for example, to "persist" a network socket across Addon reloads:
try:
socket_that_survives_reloads
except NameError:
socket_that_survives_reloads = None
if not socket_that_survives_reloads:
print("creating new socket connection")
socket_that_survives_reloads = however_you_connect()
else:
print("re-using existing socket connection")
print
is getting tiresome, you might be interest in this question about debugging. $\endgroup$