title: How to loop over all functions of another class using a list of function type elements?
body: <p>I am trying to get a list of all the functions in a class and then looping over them so they are all executed without having to type each one out. For example:</p>
  <pre><code>class Foo:
      def foo(self):
          print('foo')
  
      def bar(self):
          print('bar')
  </code></pre>
  <p>Then in another file</p>
  <pre><code>import Foo
  import inspect
  
  newfoo = Foo()
  functions = [f for f in inspect.getmembers(Foo, predicate=inspect.isfunction)]
  for f in functions:
      newfoo.f[1]()
  </code></pre>
  <p>I am hoping to get:</p>
  <pre><code>foo
  bar
  </code></pre>
  <p>But this gives the error</p>
  <pre><code>AttributeError: 'Foo' object has no attribute 'f'
  </code></pre>
  <p>Any ideas on how to execute this? Thanks in advance.</p>