app/__ init__.py
from blah import test
app/x.py
from app import *
test()
Basically, I have an __init__.py
file that contains a bu开发者_开发百科nch of imports that will be used throughout the app. I've put them all in here to save me having to import them into each file (every file within this folder will use the same imports)
I'm wondering if that from app import *
line is causing it to import itself as it is inside the app
folder...
Am I doing this correctly?
Subpackages and modules within a package are never imported when the package is imported unless they are explicitly imported within __init__.py
. Even if they were, the most that would happen is that the module would contain a reference to itself, which is not considered a problem.
精彩评论