I've opted to use the Python Language Server instead of Jedi.
My project root folder has a subfolder named "cdk_app", and in that folder is file cdk_app_stack.py. That file defines class "Lemoncello"
in the project root folder my file app.py has this line:
from cdk_app.cdk_app_stack import Lemoncello
"cdk_app.cdk_app_stack" is marked by vscode as an unresolved reference. (but it runs properly.)
if I change it to
cdk_app_stack import Lemoncello
(removed the folder qualifier) vscode resolves it ok (and it runs ok)
this is only an issue when I use the project venv. When not, both syntax resolve and run.
Why is the reference unresolvable when I specify the subfolder name, when using a venv?
Thanks all.
The problem involved easy-install.pth in my python site-packages folder. This file was created by the AWS CDK installer (I believe). It had a reference to the venv subfolder. This is all quite proper, but the Python Language Server doesn't handle it well. If I removed this pth file, the problem went away. Of course, that's just a workaround, and Python Language Server will presumably work better in this scenario, someday.
For some chatter about a different language server issue with pth files, see https://github.com/microsoft/python-language-server/issues/537
To turn off the language server, configure vscode as "python.jediEnabled": true (which is the default.)