How to fix AttributeError: partially initialized module?

This can happen when there’s a local file with the same name as an imported module – Python sees the local file and thinks it’s the module.

In my case, I had a file I created in the same folder called requests.py. So my code was actually importing that file and not the actual requests module you install with pip. Then I had another issue with a file I created called logging.py. I renamed both files and the issue was resolved.

Leave a Comment