Skip to content Skip to sidebar Skip to footer

How To Call A Fucntion From A .py File In Jupyter Notebook?

I don't want to write the same function in each Jupyter Notebook files. It would be easier if I just need to edit the function once without the need to edit in each .ipynb file. Th

Solution 1:

Yes, you need a make .py file with function defined and import that file then call the functions in it. put it in the same folder as notebooks.

the filename.py file example

deffunction_name(param1,param2):
    #dosomtingreturn

and how to import it

from filename import function_name

function_name(param1,param2)

Post a Comment for "How To Call A Fucntion From A .py File In Jupyter Notebook?"