db = DataBase('root', '1234', 80)
db.connect() # Соединение с БД: root 1234 80
db2 = DataBase('root2', '5678', 40)
print(id(db))
print(id(db2))
print(id(db) == id(db), db is db2)
db.connect() # Соединение с БД: root2 5678 40
db2.connect() # Соединение с БД: root2 5678 40def check_for_cancel(text):
    return text.lower() in ['отмена', 'stop', '/stop', 'cancel']
def ur_secondname(message):
    if check_for_cancel(message.text):
        bot.send_message(message.chat.id, 'Отмена пользователем!')
        return
        
    user_data = {} #создаем словарь
    ..." ".join(usernames)
в самом начале вы уже получаете все записи вот тут
Лучше этот результат обходить и брать значения оттуда, чем каждый раз запрашивать то, к чему у вас уже доступ есть