Is there any nice way to import different modules based on some variable value? My example:
I have a folder with different modules:
- module_a.py
- module_b.py
And in some other python file i want to import either module_a or module_b based on some config value:
if configVal == 'a':
import module_a
elif configVal == 'b':
import module_b
Is there some way to avoid using if-elifs? So somehow automatically?
like:
@conditionalImport(configVal)
import module_
Or something clever?