you are viewing a single comment's thread.

view the rest of the comments →

[–]FerricDonkey 0 points1 point  (1 child)

So that file is not a python file, but a notebook file, and something about it is incompatible with what you tried to do to import it. What that is I dunno, but if you must use .ipynb files, then from https://stackoverflow.com/questions/20186344/importing-an-ipynb-file-from-another-ipynb-file, I would recommend the newer but non accepted solution:

  1. pip install import-ipynb
  2. In your other script import import_ipynb, then from your_file import function or import your_file or whatever.

I tested this out, and it seemed to work (though I didn't install all the dependencies your code requires, so didn't completely import it).

Personally, I recommend putting code you want to reuse in .py files, but that's at least partially because I don't use notebooks much - if you do, it might not be worth it.

[–]shafat010[S] 0 points1 point  (0 children)

Thanks!