title: Calling a function in a different python file using Google Colab?
body: <p>I'm working on a project for which I need to call functions from several python files to use in one main program. All of the programs in question are notebooks in the same directory in Google Colab. I am having trouble being able to call the functions I need and I haven't been able to find a solution that works. I've tried simply <code>from InterpolateData import LoadandInterp</code> where <code>InterpolateData</code> is the file name where the function <code>LoadandInterp</code> is stored. This is what I currently have:</p>
  <pre><code>from google.colab import files
  import sys
  sys.path.append( &quot;/content/drive/My Drive/Colab Notebooks&quot;)
  import InterpolateData
  import numpy as np
  import pandas as pd
  from scipy.interpolate import griddata
  
  #get, normalize and interpolate data
  
  #SpectralHighData
  temperatureList=np.arange(25.0,46.0,1.0)
  interpList=np.arange(25.0,45.0,0.1)
  pathBefore=&quot;/content/drive/My Drive/Colab Notebooks/Original Data/High Temperatures/Spectral_high/CdTe Spectra Interpolated &quot;
  pathAfter=&quot;C.csv&quot;
  
  interpolated=InterpolateData.LoadandInterp(temperatureList, interpList, pathBefore, pathAfter)
  </code></pre>
  <p>Everything that I've tried returns an error along the lines of <code>ModuleNotFoundError: No module named 'InterpolateData'</code></p>
  <p>Does anyone know a way I can get this to work? Surely, there is a way?</p>
  <p><strong>Edit:</strong> Before the previous code, I have code to mount my google drive and change the directory to where the files are stored. It looks like this:</p>
  <pre><code>from google.colab import drive
  drive.mount('/content/drive', force_remount=True)
  
  !ls &quot;/content/drive/My Drive/Colab Notebooks&quot;
  %cd &quot;/content/drive/My Drive/Colab Notebooks&quot;
  </code></pre>