On 02/22/2013 09:11 PM, Rohit Mediratta wrote:
> I want to reload my Module after I fix bugs and want to instantiate an object of a class contained in this module.Hi All,
>
> Heres the pseudo code of what I want to do:
>
> def rerun(testBlock) :
> op = testBlock.split('.')
> module = op[0] ; className = op[1]
> reload(module)
> # testBlock is a string, so it needs evaluation!
> newObject = testBlock()
>
> rerun('ModuleName.className')
>
>
> Obviously, line 4 and line 6 dont work today.
> I want to know if there is any smart way to achieve this.
> In my previous life (Tcl), I could use 'eval' or 'set' to achieve this.
>
>
> thanks,
> Rohit
>
>
> _______________________________________________
> Tutor maillist - [email protected]
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutorYou can do: module = __import__(module) -m -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ "The condition of man is already close to satiety and arrogance, and there is danger of destruction of everything in existence." - a Brahmin to Onesicritus, 327 BC, reported in Strabo's Geography _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
