Home>

I want to call mymod.ipynb that I created from mytest.ipynb program and execute it.
In Notebook, the error ModuleNotFoundError: No module named'mymod'

Change the extension to .py and try it with IDLE software, it works fine.

Is there a way to run ipynb extension in Notebook?

Error message

ModuleNotFoundError: No module named

Applicable source code

python

mymod.ipynb

def myfunc ():
print ("Hello!")

mytest.ipynb

import mymod
mymod.myfunc ()

Tried

Change the extension to .py and try it with IDLE software, it works fine.

Supplemental information (FW/tool version etc.)

Please provide more detailed information here.

  • Answer # 1

    You may not be able to do it, but you usually don't. I don't know how to answer.

    Jupyter notebook is not dedicated to Python, but is designed to be used in other languages ​​such as R and Ruby, so code that can be used in Python is not always written. So it doesn't seem to be a mechanism that can be imported in general.

  • Answer # 2

    I saw this tweet.

      

    A tool that allows you to extract a script from a Jupyter Notebook into a Python/R/Julia file, and then modify the file back to Jupyter. Now you can edit the Jupyter script with your favorite editor.

    jupytext

    Source