run-time inclusion of files

Chris Rebert clp2 at rebertia.com
Sun Sep 6 00:25:57 CEST 2009


On Sat, Sep 5, 2009 at 3:23 PM, <travis+ml-python at subspacefield.org> wrote:
> Hello,
>
> I was wondering if there was something like Perl's "require" that allows
> you to import a file whose name is specified at run-time.  So far I've only
> seen imports of modules that are put in the standard module include path.

You'll need to use the `imp` module:
http://docs.python.org/library/imp.html#module-imp

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list