title: Google Colab custom module has no attribute
body: <p>What I am trying to do is to define a function in a custom module on Google Colab. 
  I created a *.py file to define the function. It is</p>
  
  <pre><code>/content/gdrive/My Drive/Colab/myfunc.py
  </code></pre>
  
  <p>Then I created a *.ipynb file at the same folder. It is</p>
  
  <pre><code>/content/gdrive/My Drive/Colab/test.ipynb
  </code></pre>
  
  <p>In myfunc.py, the code is</p>
  
  <pre><code>def somefunc(a)
    return a*2
  </code></pre>
  
  <p>In test.ipynb, the code is</p>
  
  <pre><code>cd /content/gdrive/My\ Drive/Colab
  import myfunc
  myfunc.somefunc(2)
  </code></pre>
  
  <p>Then it occurs error "AttributeError: module 'myfunc' has no attribute 'somefunc'"</p>
  
  <p>I also used </p>
  
  <pre><code>   dir(myfunc)
  </code></pre>
  
  <p>in test.ipynb, which shows </p>
  
  <pre><code>['__builtins__',
   '__cached__',
   '__doc__',
   '__file__',
   '__loader__',
   '__name__',
   '__package__',
   '__spec__']
  </code></pre>
  
  <p><strong>My function 'somefunc' is not in the attributes!!!</strong></p>
  
  <p>This problem only occurs on Colab. I tried it on my computer and an online Jupyter notebooks. They are both working correctly.</p>
  
  <p>PS: No matter whether I put an empty <code>__init__.py</code> file in the same folder or not, the problem always exists.</p>