How to get the Go to Definition feature in VSCode working for absolute imports?

46 Views Asked by At

In general, Go to Definition feature does work in my VSCode, however, in the below case

varshini@dell:~/src/loan-predictions$ tree
.
|-- Makefile
|-- README.md
|-- requirements.txt
|-- setup.py
`-- loan_predictions
    |-- client
    |   |-- __init__.py
    |   |-- __pycache__
    |   |   `-- __init__.cpython-37.pyc
    |-- scripts
    |   |-- automatic_pipeline.py
    |   |-- generate_map_user.py
    |   |-- generate_reports.py
    |   |-- launch_slad_from_slack.py

loan_prediction/pipeline/analysis/init.py -

from .analysis_tracker import AnalysisTrackerOccultation

PYTHONPATH -

PYTHONPATH=:/home/varshini/src/loan-prediction

given all the set up existing already,

VSCode is not recognizing the definition of AnalysisTrackerDefaulter from 'loan_prediction.pipeline'

spoc_occultation/scripts/automatic_pipeline.py -

from loan_prediction.pipeline import AnalysisTrackerDefaulter

I already tried -

  1. Setting PYTHONPATH (as mentioned above)
  2. Setting the Python Language Server to Pylance

Note: Go to Definition (Cmd + Enter) - works for directly referred paths, but in cases like above it is unable to resolve the corresponding definition. It is making my code navigation difficult?

You suggestions to resolve this would be greatly helpful.

0

There are 0 best solutions below