Page MenuHome

error when removing an addon and installing an updated version in the same Blender session
Closed, InvalidPublic


System Information
Operating system: Linux-4.13.10-041310-generic-x86_64-with-debian-stretch-sid 64 Bits
Graphics card: GeForce GTX 1050/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 390.67

Blender Version
Broken: version: 2.80 (sub 74), branch: blender2.7, commit date: 2019-06-12 18:00, hash: rB2404220e80a9

Short description of error
I'm having problems when attempting to update an addon to a new version in a single Blender sesssion.
I provide 2 versions of a simple demo addon below. All they do is import a function from another python file. This file is differetn in version 0.2 than it is in version 0.1
I first remove the old version from inside Blender, this completely removes the addon from disk. If I then attempt to install and activated the new version, which imports a different function, the following error pops up.

Traceback (most recent call last):
  File "/opt/blender 2.80/2.80/scripts/modules/", line 330, in enable
  File "/opt/blender 2.80/2.80/python/lib/python3.7/importlib/", line 169, in reload
    _bootstrap._exec(spec, module)
  File "<frozen importlib._bootstrap>", line 630, in _exec
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/x/.config/blender/2.80/scripts/addons/UPDATEmachine/", line 14, in <module>
    from . utils import new_function
ImportError: cannot import name 'new_function' from 'UPDATEmachine.utils' (/home/x/.config/blender/2.80/scripts/addons/UPDATEmachine/

To me it looks like, while the addon is removed completly from disk, it still hangs in memory at least partly. Is there something I can do about it? Or is it an issue with Blender? This is not related to classes not being ungegistered, there are none in this addon. It's just caused by changing function imports.

For clarity, here's a video.

Exact steps for others to reproduce the error

  • open Blender and install and activate from the zip file
  • remove UPDATEmachine
  • install and activate
  • the error above should pop up



Event Timeline

MACHIN3 (MACHIN3) updated the task description. (Show Details)
Bastien Montagne (mont29) closed this task as Invalid.
Bastien Montagne (mont29) claimed this task.

Once imported, python keeps a module in cache. I think you'll have to use importlib.invalidate_caches() for this to work properly. And/or importlib.reload() too, maybe…

No Blender bug here, we shall not invalidate our whole cache every time and add-on is enabled or disabled. ;)

Thank you, I've tried invalidate_caches(), but it didn't seem to have any affect. reload() works very well! Thanks!