Im trying to import a set of modules that are defined by an array. The reason I would like to store them in an array is because I would like to change this list dynamically.
moduleNames = ['sys', 'os']
import moduleNames
However this doesnt work.
I have searched around and found this:
moduleNames = ['sys', 'os']
modules = map(__inport__, moduleNames)
This imports the modules however I would like to be able to access it by doing sys.version for example. Rather than by using modules[0].version
Is this currently possible I can't seem to find anywhere that shows you how to do it.
syswas imported (so it knows to usesys.version)?