Fixing [Pyright] Import could not be resolved in emacs

Say you open any python file containing an import. Your IDE is spacemacs and pyright. You might encounter this error:

[Pyright] Import "anymodule" could not be resolved

In order to get rid of this error, hit:

, F a

This launches lsp-workspaces-folders-add which requires you to enter the project’s path e.g. ~/tmp/mypython/ as workspace.

I had only ~/tmp/ in the lsp-workspaces and thought it is enough. Deleted this folder with: , F d .