I have a file, myfile.py
, which imports Class1
from file.py
and file.py
contains imports to different classes in fi
In the myfile module, you can either do from file import ClassFromFile2
or from file2 import ClassFromFile2
to access ClassFromFile2, assuming that the class is also imported in file.
This technique is often used to simplify the API a bit. For example, a db.py module might import various things from the modules mysqldb, sqlalchemy and some other helpers. Than, everything can be accessed via the db module.