A
A
asker6662020-09-21 16:05:10
Python
asker666, 2020-09-21 16:05:10

Why doesn't python see the function?

There is this piece of code:

_set_recipient(connection, recipient)

def _set_recipient(connection, recipient):
    with connection.cursor() as cursor:
        sql = "UPDATE qiqibot SET recipient = '"+recipient+"' WHERE `id` = 1"
        cursor.execute(sql)
    connection.commit()


those. in the code, after the function call, the _set_recipient function immediately goes right after, to which I get an error:
5f68a4d21d499339947064.jpeg

why is this happening and how to fix it? python 3.8.5 windows 10

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WolfInChains, 2020-09-21
@asker666

because you call it first and there is nothing else to call, move it _set_recipient(connection, recipient)below the function

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question