title: How to dynamically call methods within a class using method-name assignment to a variable
body: <pre class="lang-py prettyprint-override"><code>class MyClass:
      def __init__(self, i):
          self.i = i
  
      def get(self):
          func_name = 'function' + self.i
          self.func_name() # &lt;-- this does NOT work.
  
      def function1(self):
          pass # do something
  
      def function2(self):
          pass # do something
  </code></pre>
  
  <p>This gives the error: <code>TypeError: 'str' object is not callable</code></p>
  
  <p>How would I go about doing this?</p>
  
  <p>Note: <code>self.func_name</code> also does not work</p>