Breaking code into multiple files on Windows

asked 2020-08-06 02:08:35 +0100

kaba gravatar image

In Jupyter on Windows, I create a Notebook "testa.ipynb" as follows:

def f():
    return 3

I then create another Notebook "testb.ipynb" as follows:

import testa
testa.f()

Running this produces the error "No module named 'testa'". The files are in the same directory, which is the default "C:\Users\<user>".

How can I break my code into multiple files like this?

edit retag flag offensive close merge delete

Comments

Try to make testa live somewhere where the PYTHONPATH (or sage) finds it. Then check this in the sage ipyton console.

dan_fulea gravatar imagedan_fulea ( 2020-08-10 17:09:34 +0100 )edit