I am running a script in Visual Studio Code 2, for which I have the following import line from module_name.blah.foo import bar
The script works fine, but I get a "problem" message saying Import "module_name.blah.foo" could not be resolved
.
If I hover above the line in the script, I get the message Import "module_name.blah.foo" could not be resolved Pylance(reportMissingImports)
As the script works, this isn't hugely important, but I would like to get rid of the ever-present list of "problems" indicated for the script in the problems window and next to the filename, so I'd like to solve this if possible.
I saw another stack overflow post that might help. However, when I tried the first step, print(module_name.__file__)
, I get the error NameError: name 'module_name' is not defined
Does anyone know how to deal with this?