0

enter image description here

I am not able to call functions from another Python file named fetch_data. I am using VS Code.

Edit: Now I am able to import the function from the solution given by Molly. But I am still receiving error in VS Code. enter image description here

2 Answers2

2

In VSCode:

  • set breakpoint before import
  • in the debug window:
    • import sys
    • sys.path[0]
    • put fetch_data.py in the shown folder
  • restart execution

In StackOverflow:

  • give credits for any help
  • learn about editable installs
Peter
  • 10,959
  • 2
  • 30
  • 47
  • Thank you for your suggestions sir. Being a beginner I am still trying to learn. Currently the solution given by Molly, seems to be working. And I will surely learn about editable installs. Thanks again. – Shivam Tawari May 25 '21 at 07:06
1

Open Workspace Settings.json, add

"python.analysis.extraPaths": [
    \path\to\folder\which\includes\fetch_data,
],

Then reload window, the error should go away.

Molly Wang-MSFT
  • 7,943
  • 2
  • 9
  • 22