Hi. I have a rather specific issue when trying import flask into my project using the typical syntax:
from flask import Flask
PyCharm finds the module flask just fine, it even suggests it and displays the correct path of the __init__.py file when I hover over it. But it seems it cannot find the Flask class.
The code runs fine, I can execute it using the the flask executable or the genererated run configuration. Visual Studio Code doesn't have any issues with the module, even when I use the same project and virtual environment. This issue only affects Flask, other modules and their classes can be imported.
I already tried the following steps:
- Update PyCharm
- Create a new project with pipenv and virtualenv
- Create a project directory virtual environment using pipenv outside of PyCharm (it worked, but did not fix the import)
- Invalidate PyCharm's caches
- Check my project and Python file name (no collisions here)
- Remove the system wide flask package
- Install an older version of Flask
- Check my file system permissions (my user can read and write everything)
- Test the environment with vscode (everything works as expected)
I am starting to run out of ideas what else I could check and hope someone can give me a hint.