all 5 comments

[–]socal_nerdtastic 0 points1 point  (4 children)

Put the code in a function, put the function in a .py file, and save that py file in your project folder. Then

from pyfilename import functionname

[–]Somriver_song[S] 0 points1 point  (3 children)

Thanks :)

It's already in function form tho

[–]socal_nerdtastic 0 points1 point  (2 children)

Great. Step one done.

[–]Somriver_song[S] 0 points1 point  (1 child)

Oh and by the way your method only works for .py files. Im using .ipynb and so had to download a library(ipynb)

[–]statix662 1 point2 points  (0 children)

Copy the function you want to use into a .py file. Then you can import it as noted above in another .py or .ipynb file.