I’m confused on how to do this, I’m passing in a dictionary with different values, such as “app” which is the name of the app (so that I can better decouple code for easier modularization).. so this is just a simplified example and its not working so I’m wondering how to use the variable “app” within the string that is calling the models import.. thanks for any advice
infodict={'app':'myappname'}
app = infodict['app']
from web1.app.models import modelname
You probably need something like importlib (Python 2.7). If you version of Python doesn’t have
importlibthen you can use plain old__import__.For example: