doing non-prespecified imports

J

Jon Perez

Is it possible to do:

import xxxx

within code where xxxx is specified by
a string or user input?


I need this in order to be able to load different,
arbitrary modules under application-user control.

If not using the 'import xxxx' syntax, is there
a roundabout way to do such?
 
E

Egbert Bouwman

Is it possible to do:

import xxxx

within code where xxxx is specified by
a string or user input?


I need this in order to be able to load different,
arbitrary modules under application-user control.
See the built-in function __import__()
egbert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top