I use the following structure in the project:
CleanMaster - Libs - programclass - __init__.py - ShowScreens.py - main.py - program.py main.py - runs when the application starts and simply imports the main class of the Program from the module program.py
In the Libs / programclass package, I hold classes that I inherit in the Program class.
Example of the class architecture of the Program.py module:
from Libs import programclass as program_class # классы программы class Program(program_class.ShowScreens): def __init__(self, **kvargs): super(Program, self).__init__(**kvargs) # Теперь мне доступны все атрибуты и методы класса ShowScreens. self.attribute_class_program = True The code of the __init__.py file from the Libs / programmclass package:
from .ShowScreens import ShowScreens An example of the ShowScreens class architecture of the ShowScreens.py module from the Libs / programmclass package:
class ShowScreens(object): # Здесь мне доступны все атрибуты и методы класса Program, # которые упомянуты в его конструкторе через ключевое слово self. print self.attribute_class_program Question: how correct is this approach?