On Tue, Aug 7, 2012 at 6:00 PM, Gelonida N <gelonida at gmail.com> wrote: > modulename = 'my.module' > cmd = 'import %s as amodule' > try: > exec(cmd) > print "imported successfully" Someone will doubtless correct me if I'm wrong, but I think you can avoid exec here with: amodule=__import__(modulename) ChrisA