Breaking code into multiple files on Windows

asked 4 years ago

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?

Preview: (hide)

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 ( 4 years ago )