When using Visual Studio Code as a Python editor,you might encounter the “Unresolved import error” yet the code functions properly and the import is legit.
Here are some solutions that worked for me.
1.Set "python.jediEnabled` is `True` in the settings
Go to command pallet by pressing CTRL+SHIFT+P
Type:Configure Language Specific
Select Python and wait for the settings.json file to open
Search for “python.jediEnabled“
Change its value from False to True or comment it by adding a “#” at the start of that line
Restart VS Code for the changes to take place.
NB:- Jedi is an awesome autocompletion, static analysis and refactoring library for python.Read more here: http://jedi.readthedocs.io
2.Set the Python environment or interpreter for your project
Always check the bottom left panel of VS Code to see what interpreter has been chosen for your project