M
Personally, I make a conditional on the MVC patternum (although it's hard to name this reality here as a real pathter, but I'm pushing away from it), which is to build an architecture based on it. model:view:controller♪♪ app.py all static variables, e.g. a box, a copy of the dispatcher, a copy app- Object, if you use Flask/FastAPI and webhooks♪ In principle, other statistical data can be produced.♪ controller.py There's all the logic, maybe distributed in their classes. Sometimes you can create other dependent files - they only need to be connected with copies of the file. app.pyAnd all, you can build a logic on different files as you asked. You may be a scam, but the Bottom PLO is a controversial subject.NOTE: In order not to make mistakes about partially initiated objects, it is necessary in every file at all times. First import from the file app.pyas some decorators refer to these objects from this file (app.pyThat's what's basically breaking the main logic of work.♪ models.py Database models should be established, if you know ORM, otherwise you can simply create a function that is responsible for connecting to the database.In the file. main.py an entry point shall be established. It is possible to establish a regime DEBUG - very convenient use if data are often entered in the code. The logic of work is, however, if DEBUG That's it. TRUEThen start the method executor.start_polling(dp)Otherwise, a web server will be launched. I'm using for my purpose. uvicorn♪In the file. config.py all basic confidential data shall be provided. You can hide them in variable environments.At the same time, in order to build such an architecture, each task should be assigned to its function. If you push off the pathterne, it's necessary necessary if some file disconnects the function or removes any function - it doesn't break the whole logic of the bott, that is, every file must be independent (subject) from each other.