0

I have two files named as funcs_.py and data.ipynb and I am trying to import a variable conn from ipynb to py file I am doing like this

from ipynb.fs.full.data import conn 

But it is giving me error that cannot import conn from data

Any help is appreciated

1 Answers1

0

See axil's answer (https://stackoverflow.com/a/47558146/2985694) in Importing an ipynb file from another ipynb file? (even though the question is about importing .ipynb into .ipynb it works for importing .ipynb into .py).

Note that what you will pip install has a hyphen (import-ipynb), what you import has an underscore (import_ipynb)


Aside: I found your question by searching [import ipynb function regular python] in a search engine. I clicked the other results even though they didn't match what I was looking for but I tried it and it worked.