title: Python-calling method outside of class
body: <p>I come from ruby/C# and am new to Python. </p>
  
  <p>I'm looking at the following code:</p>
  
  <pre><code>def raiseFlag():
      global flag
      flag = 1
  
  class TermStructureTest():
  
      def testImpliedObs(self):
          global flag
          flag = None
          h = RelinkableYieldTermStructureHandle()
          settlement = self.termStructure.referenceDate()
          new_settlement = self.calendar.advance(settlement,3,Years)
          implied = ImpliedTermStructure(h,new_settlement)
          obs = Observer(raiseFlag)
          obs.registerWith(implied)
          h.linkTo(self.termStructure)
          if not flag:
              self.fail("Observer was not notified of term structure change")
  </code></pre>
  
  <p>Why does is it work to call "raiseFlag" within the TermStructureTest() class? </p>