title: Pass variable to python function from bash script
body: <p>I am really struggling trying to figure out to pass variables from a bash script to a python function I have made.  I have looked over numberous posts about the same issue and cant seem to understand what I am missing. </p>
  
  <p>I have a python function script named fname_function.py:</p>
  
  <pre><code>from glob import glob
  import os
  import sys
  
  first_arg=sys.argv[1]
  second_arg=sys.argv[2]
  third_arg=sys.argv[3]
  
  def gFpath(reach,drive,date):
      list1 = glob(os.path.normpath(os.path.join(drive, reach, date,'*')))
      list2 =[]
      for afolder in list1:
        list2.append(glob(os.path.normpath(os.path.join(drive, reach, date, afolder, 'x_y_class?.asc'))))
      return list2
  
  if __name__=='__main__':
      gFpath(first_arg,second_arg,third_arg)
  </code></pre>
  
  <p>And my bash script looks like:</p>
  
  <pre><code>reach="R4a"
  drive= "D:\\"
  dte="2015_04"
  
  fnames=$(python fname_function.py "$reach" "$drive" "$dte")
  
  for fname in $fnames; do echo "Script returned $fname"; done
  </code></pre>
  
  <p>The variables are being passed to the python script, but I cant seem to get <code>list2</code> back to my shell script.  </p>
  
  <p>Thanks,</p>
  
  <p>Dubbbdan</p>