Skip to content

register_next_step_handler problems #2088

@MarkyCY

Description

@MarkyCY

Good Day.
In my Telegram bot code, I have a command assigned like this:

#Main.py
from func.add_poll import addPoll, write_num

@bot.message_handler(commands=['add_poll'])
def add_poll_command(message):
    addPoll(message)

This calls the addPoll(message) function, which is located in another file:

├── main.py
└── func
    └── add_poll.py <- Just here

In add_poll.py, there's another function write_num(message, options) that's not working as expected when called with bot.register_next_step_handler(msg, write_num).

However, when you move both addPoll and write_num functions to the main.py file, everything works fine. The reason for this might be related to the way modules are imported or the order of execution. Ensure that you're importing the functions correctly and that the necessary dependencies are in place. Check for any circular dependencies as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions