title: access variables from class constructor to the class functions in python
body: <p>How to access variables from class constructor to the class functions?</p>
  
  <p>Code:</p>
  
  <pre><code>class evol:
      k = 0
      m = 0
  
      def __init__(self, file1):
          InFile = open(file1, 'rb')
          InFile = csv.reader(InFile, delimiter='\t')
          for rec in InFile:
              self.k += int(rec[0])
  
      def method1():
          print k
  </code></pre>
  
  <p>I get the error,
  NameError: global name 'k' is not defined</p>