Search code examples
pythonvisual-studio-codepylint

Python linter for VSCode thinks imports from another file in folder are errors


Basically that, i have a file called autocompletebot.py and another called main.py, and i'm importing autocompletebot from main. The code runs fine, but the constant errors messages and squiggly red lines are annoying.

I've uninstalled and installed both the linter and the vscode plugin, but the issue wasn't fixed. I'm running the latest VSCode, python 3.8.2 with pylint 2.4.4, here are some images of the error messages:

enter image description here enter image description here

All of those are in the file btw, the code runs fine, but it says there are errors: enter image description here


Solution

  • If someone has the same problem in the future, i managed to fix the problem by renaming the file autocompletebot.py to another name. I think the problem was because the folder and the file had the same name and that got the editor confused.