[BangPypers] How to dynamically load modules in Django/Python

Saager Mhatre saager.mhatre at gmail.com
Wed Dec 24 05:26:27 CET 2014


On Wed, Dec 17, 2014 at 11:19 PM, Navin Kabra <navin at smriti.com> wrote:

> Saager Mhatre <saager.mhatre at gmail.com> writes:
>
> > I suppose the __import__ function
> > <https://docs.python.org/3/library/functions.html#__import__> should be
> a
> > good start.
>
> Also check out the "imp" module.
>
> from imp import load_source
> load_source('myname', 'myname.py')
>

Navin/Dhruv,

I believe the documentation indicates that the imp module is deprecated in
3.4 in favour of importlib, which is what the __import__ function wraps
anyway.

- d


More information about the BangPypers mailing list