Getting corresponding module from function
<p>I want to modify a module xyz and its functions like that:</p>

<pre><code>def modify(fun):
    modulename = fun.__module__ # this is string. ok, but not enough

import xyz
modify(xzy.test)
</code></pre>

<p>My problem is how to access the namespace of <code>xzy</code> inside <code>modify</code>. Sometimes</p>

<pre><code>globals()[fun.__module__]
</code></pre>

<p>works. But then I get problems if the definition <code>modify</code> is in a different file than the rest of
the code.</p>
