Ask Your Question
1

how to import a function in another file

asked 2022-08-25 13:26:40 +0100

Sule gravatar image

updated 2022-08-28 11:29:03 +0100

In python it's easy to find how can I do:

from file import func1, func2, func3

But I couldn't do in jupyter notebook. It didn't read the file.

For example dag is an function in sample_code ;

import ipynb

from ipynb.fs.full.sample_code import dag


ModuleNotFoundError Traceback (most recent call last) <ipython-input-3-cb32ddc8df9f> in <module> ----> 1 import ipynb 2 from ipynb.fs.full.sample_code import dag

ModuleNotFoundError: No module named 'ipynb'

Thanks for advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-08-25 15:55:02 +0100

narodnik gravatar image

For importing sage files, try the functions load() and attach()

edit flag offensive delete link more

Comments

Thanks, i tried and resarhed; but these methods reads only text files not ipynb.

Sule gravatar imageSule ( 2022-08-28 11:30:21 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-08-25 13:26:40 +0100

Seen: 462 times

Last updated: Aug 28 '22