A module imported several times

I do some init elements when the module loads first. The problem is that somehow it is imported twice, and I can’t understand why. I thought it could be imported using a different path, as in this example:

a.py:

from apps.blog import models
...

b.py:

from blog import models
...

I insert print __name__into my module and print twice blog.models, so it turns out that the problem is not in the import path.
So, is there any other reason why a module can be imported several times?

UPDATE: I did not mention that I use django. I think this problem is related to django manage.py script: https://docs.djangoproject.com/en/dev/releases/1.4/#updated-default-project-layout-and-manage-py

+5
2

Python / . , Python . - / PYTHONPATH, .

. import pdb; pdb.set_trace() , bt, , . c. , bt , .

+8

All Articles