I have a file, myfile.py
, which imports Class1
from file.py
and file.py
contains imports to different classes in fi
Python doesn't automatically introduce anything into the namespace of myfile.py, but you can access everything that is in the namespaces of all the other modules.
That is to say, if in file1.py you did from file2 import SomeClass
and in myfile.py you did import file1
, then you can access it within myfile as file1.SomeClass
. If in file1.py you did import file2
and in myfile.py you did import file1
, then you can access the class from within myfile as file1.file2.SomeClass
. (These aren't generally the best ways to do it, especially not the second example.)
This is easily tested.