'Import is working properly but Python Support in VSCode shows warning

I am now focusing on Data Visualization with Matplotlib, and the issue I mentioned really distracts me while practicing on Python.

There is no problem after running the code. I can get expected results. Although two files are in the same directory without any typos, Visual Studio lists the following warning all the time:

import "random_wall" could not be resolved

There was a link which opened github when I clicked the first time, but now the link is not there any more.

I upload two images to help you understand my problem visually. Thanks in advance.

Python code with its issue

see the directory of files



Solution 1:[1]

The issue is basically with your virtual environment that is set in visual studio code. Change the virtual env to the one where the package is installed and it will stop showing the import warning. You can change your virtaul env in the bottom left corner or by clicking ctrl+shift+P and search for interpreter which will show you a drop down of the available interpreter in the system.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 buddemat