Как остановить выполнение цикла в другом файле с помощью telegram api?

Как с помощью кнопки в телеграм остановить функцию, находящуюся в другом файле?

Главный файл:

import time
import telebot
from telebot import types
bot = telebot.TeleBot(token=TOKEN)


@bot.message_handler(commands=['start'], content_types='text')
def start(message):
    keyboard = types.InlineKeyboardMarkup()
    keyboard.add(types.InlineKeyboardButton(text='stop', callback_data='stopfunc'))
    bot.send_message(message.chat.id, 'Меню', reply_markup=keyboard)


@bot.callback_query_handler(func=lambda call: True)
def callback_worker(call):
    """Функция обработки кнопок"""
    if call.data == 'stopfunc':
        pass   # Что сюда добавить??

Второй файл:

def test_func():
    while True:
        print("Hello")
        time.sleep(2)

Ответы (0 шт):