You are correct.<br><br><div class="gmail_quote">On 7 August 2012 14:38, Chris Angelico <span dir="ltr"><<a href="mailto:rosuav@gmail.com" target="_blank">rosuav@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Tue, Aug 7, 2012 at 6:00 PM, Gelonida N <<a href="mailto:gelonida@gmail.com">gelonida@gmail.com</a>> wrote:<br>
> modulename = 'my.module'<br>
> cmd = 'import %s as amodule'<br>
> try:<br>
> exec(cmd)<br>
> print "imported successfully"<br>
<br>
</div>Someone will doubtless correct me if I'm wrong, but I think you can<br>
avoid exec here with:<br>
<br>
amodule=__import__(modulename)<br>
<br>
ChrisA<br>
<span class="HOEnZb"><font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br>