Google Colab: use functions .py from GitHub

时间:2018-05-14 17:31:47

标签: github import google-colaboratory

I want to use functions defined in a .py file (uploaded to GitHub) in my Colab project.

I have a GitHub repository with a file "function.py" which contains

def SomeFunction():
  return 'it works'

Inside my Colab I type

!git clone url_of_my_repository

%load function.py

SomeFunction()

And I get the following error: "name 'SomeFunction' is not defined"

1 个答案:

答案 0 :(得分:0)

您可能需要os.chdir进入克隆目录。