T
T
temoan2021-09-18 21:16:23
Python
temoan, 2021-09-18 21:16:23

TypeError: 'module' object is not callable. How to fix?

bot = telebot.TeleBot("2043658444:AAGwNMo64TIOmY_UwYQ7O9L7L1ulHOvVla4")

@bot.message_handler(func=lambda message: True)
def echo_all(message):
bot.reply_to(message, message.text)

bot.polling() Throws an

error
Traceback (most recent call last):
File "C:\python\telebot2.py", line 1, in
import telebot
File "C:\python\telebot.py", line 3, in
bot = telebot.telebot("2043658444:AAGwNMo64TIOmY_UwYQ7O9L7L1ulHOvVla4" , parse_mode=None)
TypeError: 'module' object is not callable

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
o5a, 2021-09-19
@o5a

telebot.py

DO NOT name your scripts the same as the modules themselves (in this case telebot in this case). With this syntax, the script tries to import such a script instead of the telegram module itself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question