[Tutor] Reading module to import from a string

Chris Calloway cbc at unc.edu
Mon Dec 15 23:49:03 CET 2008


On 12/15/2008 5:38 PM, Shrutarshi Basu wrote:
> Suppose I have a module that I want to import called ImMod1 that's
> saved in a variable like so:
> 
> var = "ImMod1"
> 
> Is there some way to import ImMod1 by using var?

http://stackoverflow.com/questions/67631/how-to-import-module-from-file-name

-- 
Sincerely,

Chris Calloway
http://www.secoora.org
office: 332 Chapman Hall   phone: (919) 599-3530
mail: Campus Box #3300, UNC-CH, Chapel Hill, NC 27599





More information about the Tutor mailing list