How to solve unresolved import in VSCode?

Have you tried to set the interpreter in VSCode to correct value (including your virtualenv if you have one)?

Open the command palette (Ctrl-Shift-P) and choose "Python: Select Interpreter".

For more details, see: https://code.visualstudio.com/docs/python/environments


I have had this problem several times and it often works with just "exiting" VSCode since VSCode sometimes doesnt check the path. It uses the "old" settings or "path". By exiting the program and restarting it it updates this and it works (if its this problem)


After trying many things and not working ,ended up restarting everything. Erased all the files and did it again. Somehow it worked. Must have been some mistake while setting up.