title: Getting all functions of python package
body: <p>I have a multimodule Python package which has one file with class <code>MyClass</code> and few files with functions (one file can contain more than 1 function).</p>
  
  <p>I tried to get all functions in this package.</p>
  
  <p>Firstly, using the following:</p>
  
  <pre><code>modules = []
  for importer, module, ispkg in pkgutil.iter_modules(package.__path__):
      modules.extend(module)
  </code></pre>
  
  <p>but I got only module names, not module objects.</p>
  
  <p>When I tried to get functions of these modules using <code>inspect.getmembers(module, inspect.isfunction)</code>, I of course, got an empty collection.</p>
  
  <p>So, how can I got all module objects from the package for further getting functions?</p>
  
  <p>Does an easier way to get all functions from the multifile package exists?</p>
  
  <p>P.S. I need exactly <code>function</code> objects and not only their names.</p>
  
  <p><strong>Edit.</strong></p>
  
  <ol>
  <li><p><code>dir(package)</code> gives me only built-in variables:</p>
  
  <p><code>['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__']</code></p></li>
  <li><p><code>inspect.getmembers(package, inspect.infunction)</code> gives an empty
  list as well as the same code for each <code>module</code> as I described above.</p></li>
  <li><p><code>dir(module)</code> gives me the name list of all methods available for
  <code>str</code> objects (because, <code>iter_modules()</code> gives only <strong>names</strong> of
  modules).</p></li>
  <li><p>AST... Are you sure, that there isn't simpler solutions?</p></li>
  </ol>