0

I am getting "ModuleNotFoundError" when importing a python file.PFB the code:

testImport.ipynb

feet_in_miles=5280
meters_in_kilometer=1000
beatles=["John Lenon","PAul McCartney",""]

Modules.ipynb:

import testImport
print(testImport.beatles)

On running Modules.ipynb, I am getting the below error:

ModuleNotFoundError Traceback (most recent call last) in ()

----> 1 import testImport

2 print(testImport.beatles)

ModuleNotFoundError: No module named 'testImport'

Kindly let me know what's the issue.

Community
  • 1
  • 1
Kirti
  • 31
  • 1
  • 10
  • Does testImport really need to be an `ipynb` file? Could it not just be a normal `py` file? Importing a notebook into another notebook looks a bit [complicated](https://stackoverflow.com/questions/20186344/ipynb-import-another-ipynb-file). – Paul Rooney Aug 30 '18 at 03:43

1 Answers1

0

check in your directory that testImport.py is in the folder where you are running the code . New program should be in same directory

SarthAk
  • 1,628
  • 3
  • 19
  • 24