2

I have the following Projects folder structure:

enter image description here

and the file Tasks/Scripts/test.py (shown below) attaches util.py from Libs/PyLibs:

enter image description here

The file test.py executes fine without any issue, but I cannot get rid of the import warning (I am using latest neovim with lsp/mason/null-ls plugins). Similar issues were reported here and here, but none of the methods suggested there, for example putting a pyrightconfig.json or pyproject.toml file in the project root with appropriate config settings, is working for me, maybe because I have a somewhat more complex folder structure.

Any help is greatly appreciated. Thanks!

Manojit
  • 611
  • 1
  • 8
  • 18

1 Answers1

2

You can add extraPaths to pyrightconfig.json:

{
  "extraPaths": ["/home/roy/Projects/Libs/PyLibs/"]
}

extraPaths [array of strings, optional]: Additional search paths that will be used when searching for modules imported by files. - Pyright Main Configuration Options

racosa
  • 21
  • 4