No definition found for function – VSCode Python

I am using VSCode for Python along with the Microsoft for Python extension enabled in VSCode.

For Python v3.9.0 I am getting No definition found if I try to seek a function definition.

enter image description here

However, I do not get the error if I use my Conda Virtual environment for Python 3.7.0

What might be the problem?

Answer

When I used the code you provided and disabled the Python extension, I encountered the same problem as you.

Since “Go to Definition” is supported by the corresponding language service extension, it is recommended that you check that the current Python extension is available and confirm that the selected python interpreter is also available. In addition, please try to reload VSCode.