I opened a directory (on WSL Ubuntu) with VSCode with the following structure:
.
├── .vscode
│ ├── launch.json
│ └── settings.json
├── src
│ └── polls
│ ├── aiohttpdemo_polls
│ │ ├── db.py
│ │ ├── main.py
│ │ ├── routes.py
│ │ ├── settings.py
│ │ └── views.py
│ ├── config
│ │ └── polls.yaml
│ └── init_db.py
└── ve_websocket
I'm getting the warning message unresolved import ...
when importing a file located in the same directory that the one calling it. Example: for routes.py
from views import index
def setup_routes(app):
app.router.add_get("/", index)
I'm getting unresolved import 'views' Python(unresolved-import)
. Hence IntelliSense for index
function does not work.
However IntelliSense suggests this notation:
from polls.aiohttpdemo_polls.views import index
with it the index
function is recognized for IntelliSense now and no warning message appears, but when saving the file I get this error message Unable to import 'polls.aiohttpdemo_polls.views' pylint(import-error)
now.
So I cannot run this script:
[polls]$ python init_db.py
My settings.json
file has this configuration:
"python.pythonPath": "ve_websocket/bin/python3.8",
"python.linting.pylintEnabled": true,
"python.linting.pylintPath": "pylint",