How to connect 2 handlers

def send_docs(message):
    if message.text in ['1','2','3','4','5','6','7','8','9','10','v']:
        bot.send_document(, file_source) 

def send_query(message):
    cur.execute("DROP table IF EXISTS tovarniye_ostatki")
    cur.execute("CREATE virtual table IF NOT EXISTS tovarniye_ostatki USING FTS5 (nazvaniye_tovara,ostatok_tovara)")
    with open ("domstroy.csv",'r', encoding="utf8",) as file:
        for row in file:   
            cur.execute("INSERT OR IGNORE INTO tovarniye_ostatki VALUES (?,?)",row.split(";"),)
    db.commit()(nazvaniye_tovara MATCH (?)",(message.text,))
    result = result_query.fetchall()
    for i in result:
        bot.send_message(, (f"{i[1]} == {i[0]}"))

Dear forum users, please write how to run these 2 functions depending on message.text.
For example, if message.text== from 1 to 10 and the letter ā€œvā€ then let the 1-function be executed, and if message.text contains a query that is in the product names in the database, then send the name of these products to the user.
Thank you.

1 Like