E
E
estry2021-10-06 11:14:06
Python
estry, 2021-10-06 11:14:06

Function argument error. How to fix?

Hello. I can't figure out what's wrong with the argument. Here is the code:

class Name:

    def __init__(self):
        self.a = A()

    @dp.message_handler(state=AddAccount.number)
    async def get(self, msg: types.Message):
        self.а.create_session("test")

When accessing the decorator, I get the error get() missing 1 required positional argument: 'msg'
If I remove self, it works, but then I can't access the object a of class A.
Please help, how can I fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
estry, 2021-10-06
@estry

I solved the problem by contacting through the Name class
. That is:

class Name:

    a = A()

    @dp.message_handler(state=AddAccount.number)
    async def get(self, msg: types.Message):
        Name.а.create_session("test")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question