Answer the question
In order to leave comments, you need to log in
How to split telegram bot code into several files?
The telegram bot has an admin panel and many different defs.
Please tell me how to break it all into files for convenient work.
I was not banned on Google, but I can’t find normal explanations there.
Answer the question
In order to leave comments, you need to log in
In short, you need to divide the code into meaningful blocks by topic, create a separate module for each topic, and separate the selected blocks into modules. Then import the rest of the modules, or individual functions from those modules, into the main module.
First try on some simple model of three or four functions.
Here you just need to learn programming in the language (python? puff?).
bot is just a special case.
Now OOP is used - object-oriented programming.
The code is decomposed into separate files according to the principle of one class (interface, etc.) - one file
. Previously, a modular approach was common. Functions were put into one file based on logic convenient for development.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question