Your main.py
and f1.py
are fine, but on updater.dispatcher
of your main.py
something is missing. Try this:
from telegram import Update
from telegram.ext import Updater, CommandHandler, CallbackContext
#On my bots I preffer to import the entire module than a function from a module,
#because I usually have users.py (all functions for users), clients.py (all
#functions for clients), devs.py (all functions for developer's team) and so on
import f1
updater = Updater('token')
#Calling a function from a module must have a callback, as shown bellow
updater.dispatcher.add_handler(CommandHandler('hello', callback = f1.hello))
updater.start_polling()
updater.idle()
Try this and let me know if it worked for you!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…