[Tutor] Passing a variable to 'import'

Chris Keelan rufmetal@rogers.com
Wed, 19 Dec 2001 23:26:01 -0500


On Wednesday 19 December 2001 11:17 pm, Chris Keelan wrote:

Dang it! I should proof my messages.

Try it this way:

I have a piece of code like so:

>>moduleName="someModule"

>>def import_module(someModule):
        import someModule

Of course that gives me the following output:

>>Traceback (most recent call last):
>>  File "<stdin>", line 1, in import_module
>>ImportError: No module named someModule

But you all knew what I meant, right?

- Chris