I have a project (using PySide and sqlalchemy) with the following project structure
bin/
|-- db/ // sqlalchemy mapping to mysql tables
|
|-- model/ // custom TableModels (inherited from QAbstractTableModel)
|
|-- ui/ // ui files created by Qt Designer and the generated python files
|
|-- view/ // custom TableViews (inherited from QTableView)
|
|-- widget/ //custom widgets (inherited from QWidget)
My problem started when I created the custom tableViews. Simplifying it, i have a CustomerWidget and an OrderWidget, each of them uses a TableView which displays customer and orders respectively. I made some custom views so that from the customerTableView you can right-click and launch an orderWidget with all of those customers orders. Conversely, from the orderWidget you can right-click it and launch a customerWidget with the customer from that order.
This generated an import problem as customerWidget imports customerView which imports oderWidget which imports orderView which imports customerWidget. (In actuality I have a bunch of widgets that can launch one another).
I was importing using the from ... import syntax. I actually "solved" this by using a regular import.
I was wondering however if there's another, more "elegant", way to solve this, since right now my code is full of stuff like
self._model = bin.model.customerTableModel.CustomerTableModel(args)
and I would really really like to have it as
self._model = CustomerTableModel(args)
Thank you for your help.