I am working on some coding work with google colab ipython notebook. From book1, I need to call some functions that are defined in book2.
Book1 and book2 are all located in the same google drive and same folder.
book1:
from google.colab import drive
drive.mount('/content/drive', force_remount=True)
from kora import drive as kora_drive
kora_drive.link_nbs()
import book2 as b2
b2.function1()
book2:
def function1():
print('function1 called')
When I link the book2 from book, function1() can be called successfully. But, if I changed some code in book2, for example, added a new function in book2
def function2():
print('function2 called')
After making the changes in book2, I clicked "save" and also refreshed the drive and the folder and the book2 and book1. But, when I tried to call function2 from book1, I got error:
AttributeError: module 'book2' has no attribute 'function2'
I have tried to remount the drive and reimport the book2 and also tried the following two posts, but none of them work.
https://stackoverflow.com/questions/53358250/google-colaboratory-how-to-refresh-google-drive
https://stackoverflow.com/questions/59020008/how-to-import-functions-of-a-jupyter-notebook-into-another-jupyter-notebook-in-g
Could anyone point out what I have missed here ?
thanks
UPDTAE
In book1, I have tried
!pip install import-ipynb
import import_ipynb
import sys
sys.path.insert(1, r'/content/drive/MyDrive/Colab Notebooks/book2.ipynb')
I have also tried
sys.path.insert(1, r'/content/drive/MyDrive/Colab Notebooks/')
But, the most recent updates of "book2" still cannot be found from book1.ipynb.