I've fiddled with a problem, and have not been able to find a solution. VS Code will not recognize module imports, and thus put a yellow squiggly line under the functions, like this:
These are on every function that imports, but it renders and executes perfectly fine when the main file is executed. The issue is solely in the visualization of the code within VS Code.
My Versions
- MacOS Mojave 10.14.5
- VS Code 1.36.1
- Python 3.7.3
I've Tried
- Setting VS Code source to
/usr/bin/python
- Setting VS Code source to
/usr/local/bin/python3
- Reinstalling Python
- Reinstalling Python3
- Googling
- Changing
false
totrue
in"python.jediEnabled":
insettings.json
My Structure:
To illustrate the problem, here is a simple app:
Directory
Note: Same error with init.py in the animals/ directory.
init.py
from animals.bird import *
from animals.reptile import *
app.py
from __init__ import *
print_bird()
print_reptile()
animals/reptile.py
def print_reptile():
print("I'm a reptile. ssssssssss!")
animals/bird.py
def print_bird():
print("I'm a bird. tweet!")
And when running python3 app.py
or python app.py
the result is always the expected text of:
I'm a bird. tweet!
I'm a reptile. ssssssssss!