Access .py class from a jupyter notebook


I’ve got some classes that run locally on my machine. I can put them in storage on the collaboratory, but when I try to access them, it doesn’t find them. So
from stateMachineClass import FSAHelperFunctions
can’t find the file that I’ve loaded into storage. How do I access those classes?


This is the answer that me and Chris have got from Andrew Davison,
hoping it could be useful for others

Hi Chris, Alberto,
There are three main ways to get code into a collab Jupyter notebook:

(i) put it on Github (or similar) and “git clone” it into the notebook filesystem

(ii) put it in the collab storage, then use the storage client [1] to copy it into the notebook filesystem

(iii) put it in CSCS Swift storage, then use the archive client [2] to copy it into the notebook fileystem

This situation will improve once version 2 of the Collaboratory is released (later this year, I think), as the new collab storage will be mounted directly in the notebooks, but for the time being you always have to manually copy files from some kind of persistent storage into the notebook.