I have a file readfunctions.py inside a folder called functions (in this folder there is also a "init.py" file). In the file readfunctions.py I have defined a function called "read_from_shower".
./functions
readfunctions.py
__init__.py
So, I have imported this in my Google Colab Session (from GitHub after I cloned the repository):
from functions.readfunctions import read_from_shower
And it works fine. But then, I have made some changes in my function "read_from_shower" but I can reload it in Colab.
How can I do it?
The reload() method is used to reload a module. The argument passed to the reload() must be a module object which is successfully imported before.
Click on “Choose Files” then select and upload the file. Wait for the file to be 100% uploaded. You should see the name of the file once Colab has uploaded it. Finally, type in the following code to import it into a dataframe (make sure the filename matches the name of the uploaded file).
You need to click on Mount Drive Option to the pane on the left side of the notebook and you'll get access to all the files stored in your drive. For importing multiple files in one go, you may need to write a function. Save this answer.
You can restart the runtime (which is annoying), or use something like
import importlib
importlib.reload(functions.readfunctions)
Just put this someplace
%load_ext autoreload
%autoreload 2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With