Function to import module to namespace
- From: bvdp <bob@xxxxxxxxxxxx>
- Date: Sun, 29 Jun 2008 12:08:36 -0700
Is it possible to do this from a function: import a module and append the defs in that module to an existing module/namesapce.
So, in my code I have something like:
# main code
import mods
def loadmore(n):
import_module(n, mods)
.....
# end of main
this will permit the addition of the the stuff in file 'n.py' to 'mods'.
Assuming that foo1() is defined in newmod, I should now be able to do something like mods.foo1().
Thanks.
.
- Follow-Ups:
- Re: Function to import module to namespace
- From: Terry Reedy
- Re: Function to import module to namespace
- From: Cédric Lucantis
- Re: Function to import module to namespace
- Prev by Date: Re: using urllib2
- Next by Date: Re: gelato - nvidia and python
- Previous by thread: gelato - nvidia and python
- Next by thread: Re: Function to import module to namespace
- Index(es):
Relevant Pages
|
|