How to import modules written by yourself under jupyter notebook

There are three points to note when importing modules written by yourself under jupyternotebook:

1. To program the module written by yourself in .py file instead of .ipynb file

2. After changing the content of your own module, you need to Restart the kernel to reflect in the .ipynb file that uses the module.

3. If the .py file, put it in the folder. You need to add the folder name in front of the beginning. For example. There is a hello function in the test.py file. The test.py file is placed in the untitled folders folder, as shown in the figure below. When importing the module: from Untitled Folder.test import hello 

Guess you like

Origin blog.csdn.net/weixin_40244676/article/details/104444809