Search code examples
pythonipythonjupyter-notebookgoogle-cloud-datalab

How to execute a python notebook inside another one at google cloud datalab


I'd like to execute a python notebook I'had created to data pre-processing inside another notebook related with data classification process. So the last notebook depends on the functions and execution provided by the first notebook.

How could I do that at google cloud datalab environment? I do like to reuse the functions and variables used at the pre-processing notebook on the classification notebook.

Thanks.


Solution

  • The following should work:

    myNotebook = <relative path to notebook>
    
    %run $myNotebook
    

    or simply

    %run <relative path to notebook>
    

    Note: This does not work if you are running Datalab on Google Cloud Platform.