Calling modules from Python dir()
<p><strong>Short Question</strong><br>
Is it possible to call a module as retrieved from the python dir() function?  </p>

<p><strong>Background</strong><br>
I am working on building a custom test runner and would like be able to choose which modules to run based on a string filter.  See my examples below for ideal usage.</p>

<p><strong>module_a.py</strong>  </p>

<pre><code>def not_mykey_dont_do_this():
    print 'I better not do this'

def mykey_do_something():
    print 'Doing something!'

def mykey_do_somethingelse():
    print 'Doing something else!'
</code></pre>

<p><strong>module_b.py</strong>  </p>

<pre><code>import module_a
list_from_a = dir(module_a) # ['not_mykey_dont_do_this', 'mykey_do_something', 'mykey_do_somethingelse']

for mod in list_from_a:
    if(mod.startswith('mykey_'):
        # Run the module
        module_a.mod() # Note that this will *not* work because 'mod' is a string
</code></pre>

<p><strong>Output</strong>  </p>

<pre><code>Doing something!
Doing something else!
</code></pre>
