Каждая таблица - это отдельный класс (Table1, Table2 и т.д.), экземпляры которого обладают методами read(), process() и write(), все таблицы в отдельном модуле tables.
Во втором модуле project - класс Project, который при создании экземпляра создает список классов из модуля tables и рассчитывает выбранные пользователем таблицы.
# tables.py class Table1: def read(self): print('Читаем данные для таблицы 1') def process(self): print('Обрабатываем данные для таблицы 1') def write(self): print('Записываем данные таблицы 1') class Table2: def read(self): print('Читаем данные для таблицы 2') def process(self): print('Обрабатываем данные для таблицы 2') def write(self): print('Записываем данные таблицы 2')
# project.py import tables class Project: def __init__(self): self.lst_tables = sorted([table for table in tables.__dict__ if not table.startswith('__')]) self.tables = [tables.__dict__[key] for item in self.lst_tables for key in tables.__dict__ if item == key] self.choice_dict = {'0': self.tables} for num, table in enumerate(self.tables): self.choice_dict[str(num + 1)] = table def select_table(self): print('Введите через запятую, какие таблицы считать?') for key in sorted(self.choice_dict): if key == '0': print('\t{} => {}'.format(key, 'все таблицы')) else: print('\t{} => {}'.format(key, self.choice_dict[key].__name__)) self.selected_tables = sorted([num.strip() for num in input().split(',')]) self.selected_tables = [num for num in self.selected_tables if num.isdigit()] def calculate(self): for table in self.selected_tables: if isinstance(self.choice_dict.get(table), list): for cls in self.choice_dict.get(table): inst = cls() inst.read() inst.process() inst.write() break else: inst = self.choice_dict.get(table)() inst.read() inst.process() inst.write() if __name__ == '__main__': x = Project() x.select_table() x.calculate()
Также выслушал бы замечания и критику по самому коду.

