[Tutor] Dynamically composing a module name

Alan Gauld alan.gauld at freenet.co.uk
Wed Apr 20 00:52:00 CEST 2005


> Is it possible to dynamically compose a module name
> for import?

Yes, there is a module somewhere that allows you to import a module 
programatically by passing the name as a string. Look for an import 
or module function or module in the docs...

> Pointers to documentation or other discussions would
> be sufficient at this time.

But this begs the question why? Apart from possible environment 
differences, like importing a different module depending on OS
(which can be easier done via an if/else construct anyway) why 
would you want to?

Curious,

Alan G.



More information about the Tutor mailing list