KeyError / frozen importlib._bootstrap error on second library import in spyder

The solution was that there was no empty __init__.py file in the sub-folder tools, only in the super-folder python_library. Adding a file __init__.py into tools made it work.


I was facing the same error then as suggested I have gone through other answers but it was not working. Please check the error screenshot below.

Error: enter image description here

Then I have started looking for this file and I have found that there were at 2 places

  __init__.py file was missing.

Check below both places in your system where python tool is installed if file is not there please take it from any lib subfolder and placed it.

Library enter image description here

Lib enter image description here


When I got this error, it was because I had restructured my project and moved all the apps into a folder named 'apps'. I then changed the names of the apps in the my INSTALLED_APPS list to 'apps.***'.

I forgot, however, that I had context processors in the TEMPLATES setting whereby I needed to change the app names to 'apps.***' as well. So if anyone is in the same boat, just hit Ctrl + F and find all the other places you mention the app and make sure the full app name is correct.


command line:

touch your_python_file_directory/__init__.py