O
O
oskalevoy2021-01-24 10:16:35
Python
oskalevoy, 2021-01-24 10:16:35

TeleBot' (most likely due to a circular import) Error creating bot?

C:\pution>Tester.py
Traceback (most recent call last):
File "C:\pution\Tester.py", line 1, in
import telebot
File "C:\pution\telebot.py", line 2, in
bot = telebot.TeleBot('TOKEN');
AttributeError: partially initialized module 'telebot' has no attribute 'TeleBot' (most likely due to a circular import

) =======FULL CODE ===== import telebot bot = telebot.TeleBot('TOKEN') #binding buttons @bot.message_handler(commands=['start']) @client.message_handler(commands = [ 'get_info', 'info'



markup_inline = types.InlineKeyboardMarkup()
item_yes = types.InlineKeyboardButton( text = 'Yes', callback_data = 'yes')
item_no = types.InlineKeyboardButton( text = 'NO', callback_data = 'no')

markup_inline.add(item_yes, item_no )
client.send_message(message.chat.id, 'Do you want to buy private?',
reply_markup = markup_inline
) #button
names
@client.callback_query_handler(func = lambda call: True )
def answer(call):
if call.data == ' yes':
markupp_reply = types.ReplyKeyboardMarkup(resize_keyboard = True)
item_id = types.KeyboardButton('Buy Private')
item_username = types.KeyboardButton('Information')

markupp_reply.add(item.id, item_username)
client.send_message(call.message.chat.id, 'Click button',
reply_markup = markupp_reply
)
elif call.data == 'no':
pass #Buttons

response

@client.message_handler( content_type = ['text'])
def get_text(message):
if message.text == 'Buy private':
client.send_message(message.chat.id, f'Cost etc')

bot.polling(none_stop = True)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2021-01-24
@oskalevoy

You cannot name a script the same as an imported module.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question