[PYTHON] Error display (unresolved import'hoge') when importing self-made module does not disappear in VS Code

Introduction

At the time of development with VS Code (Python3), the import error of the self-made module placed in the same layer as the executable file could not be solved by any means, and I was addicted to it, so I shared the countermeasures. To write the conclusion first, it was just an omission of autocomplete settings. .. ..

Environmental setting

Occurrence event

--When importing a self-made class placed in the same hierarchy as the executable file, the "unresolved import" error does not disappear --There is an error on the display, but when I run the program, it works fine. 001.png

Countermeasures

Added "python.autoComplete.extraPaths" to workspace settings (settings.json), It is OK if you describe the Path of the folder where your own module is located. The example this time is as follows.

settings.json


{
    "python.autoComplete.extraPaths": ["./src/get_tweet_data"]
}

Reference article

-What to do when "unresolved import" appears in VS Code for some reason | Hobby Gramma Blog -Enable autocomplete in Visual Studio Code Python development environment | MIRAIUM

Recommended Posts

Error display (unresolved import'hoge') when importing self-made module does not disappear in VS Code
Solution when background-cover of Linux version VS Code does not work
Resolve VS Code unresolved import error
Display error message when login fails in Django
Command when ACPI shutdown does not work in VirtualBox
When "ERROR: HTTP is not supported." Is displayed in mpsyt