How to make a conditional import???
Steven D. Majewski
sdm7g at minsky.med.Virginia.EDU
Fri Nov 10 12:19:30 EST 2000
More information about the Python-list mailing list
Fri Nov 10 12:19:30 EST 2000
- Previous message (by thread): RAD for Python???
- Next message (by thread): How to make a conditional import???
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> >def selectProjectType(): > #... skipped > if projectType == 'phys': > from pyhsModule import * > else: > from logicModule import * > for a more global effect, try instead: import sys if projectType == 'phys' : import physModule sys.modules['theModule'] = physModule else: import logicModule sys.modules['theModule'] = logicModule and then anywhere, you can do: import theModule or from theModule import * import will find 'theModule' in the cache and it won't look for a file of that name. -- Steve Majewski <sdm7g at Virginia.EDU>
- Previous message (by thread): RAD for Python???
- Next message (by thread): How to make a conditional import???
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list