Brody_Brody
Brody_Brody

Reputation: 315

How to import jupyter notebook to another jupyter notebook?

So I'm trying to make a series of educational coding using jupyter. I wanted to create segmented parts by parts for exp. part1.ipynb, part2.ipynb, and so forth.

so when i use

from partuno import * 

It returns an error and does not read the previous part even though they share the same folder location in jupyter. My question is are there any other way for me to import them into the next part?

Upvotes: 4

Views: 3785

Answers (3)

Chandan Sharma
Chandan Sharma

Reputation: 2519

Install package

pip install import-ipynb

Import

import import_ipynb
import mypage
#import mypage.ipynb

Use the functions

a = mypage.test1()
print(a)

Upvotes: 0

bdeviOS
bdeviOS

Reputation: 563

Step 1.

pip import_ipynb


Step 2.

import your file at jupyter notebook. enter image description here


Step 3.

import my_math.ipynb file at test.ipynb. enter image description here

Upvotes: 2

chavan
chavan

Reputation: 21

You need to use the "import_ipynb" library of python. if you want to use the contents of one.pynb in two.pynb then

import import_ipynb
import one.pynb

now you can use the functions defined in one.pynb in you two.pynb

Upvotes: 2

Related Questions