title: Python FuncAnimation not recognizing update
body: <p>I'm learning how to animate in python for one of my projects and I'm basing my code off of the following example from <a href="http://eli.thegreenplace.net/2016/drawing-animated-gifs-with-matplotlib" rel="nofollow">here</a>.</p>
  
  <p>My adaption of their code goes as follows:</p>
  
  <pre><code>import numpy as np
  import h5py, os, glob, sys, time
  import matplotlib as mpl
  mpl.use('Agg')
  import matplotlib.pyplot as plt
  from matplotlib.animation import FuncAnimation
  
  def update(i):
      for j in np.arange(0,10):
          for k in np.arange(0,10):
              for channel in ["N","E"]:
                  x = some_x_value
                  y = some_y_value
                  line = plt.loglog(x,y)
                  ax.set_xlabel(label)
      return line, ax
  
  
  if __name__ == "__main__":
      fig, ax = plt.subplots()
      anim = FuncAnimation(fig, update, frames=np.arange(0,10), interval=200)
      anim.save('Test.gif', dpi=80, writer='imagemagick')
  </code></pre>
  
  <p>And when I try to run my script I get the following error:
  Name Error: name 'update' is not defined.</p>
  
  <p>As I said before, I'm still learning how to animate and don't understand all of what's going on in the code tutorial I found. However, I'm very confused as to why update isn't recognized at all as the way I call update seems to be exactly the same as what's in the tutorial.</p>