[Answered ]-Why does django.utils.importlib.import_module not import the correct app? And how does the variable change?

2👍

What’s happening was one of the import X lines were raising an ImportError.

i.e import gradmaker.models as gradmaker is incorrect, use from gradmaker import models as gradmaker instead.

The ImportError was caught by one of the functions called by import_module, and skipped.

So the app that this error occurred in didn’t get imported correctly.

Once the import line is fixed, all was good.

The variable didn’t change, what’s happened was the code jumped out of a function due to an error, and made weird output.

👤Eric

Leave a comment