First time here? Check out the FAQ!

Ask Your Question
1

how to import a function in another file

asked 2 years ago

Sule gravatar image

updated 2 years ago

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 2 years ago

narodnik gravatar image

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

Preview: (hide)
link

Comments

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

Sule gravatar imageSule ( 2 years ago )

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: 2 years ago

Seen: 498 times

Last updated: Aug 28 '22