D
D
DTPlayer2020-04-27 12:01:22
Python
DTPlayer, 2020-04-27 12:01:22

How to call a module from a function?

It is necessary to pull out the module from the function and use it in the code

from SimpleQiwi import *
import pyqiwi
def complete(message):
    chat_id = message.chat.id
    age = message.text
    if not age.isdigit():
        msg = bot.send_message(chat_id, 'Это не номер')
        bot.register_next_step_handler(msg, complete)
        return
    user = user_dict[chat_id]
    user.age = age
    f1 = types.ReplyKeyboardMarkup(True, True)
    f1.row('Узнать баланс', 'Перевод средств(ТОЛЬКО QIWI)')
    bot.send_message(chat_id, 'Спасибо, данные сохранены', reply_markup=f1)
    wallet = pyqiwi.Wallet(token=str(user.name), number=user.age)
    api = QApi(token=str(user.name), phone=user.age)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2020-05-09
@mrkaban

Forgive me, but what prevents you from using the file import complete
and enclosing the code that is in the file in
if __name__ == "__main__":
print('Launched as the main file, not as a module')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question