Hi, i am new to python and i wanted to build a bot for discord to make a text based rpg. I got to the point where i can "create" a character but the "status" command has a problem, which i don'T understand.
The following is the error message i get:
Traceback (most recent call last):
File "/home/runner/workspace/.pythonlibs/lib/python3.11/site-packages/discord/ext/commands/core.py", line 235, in wrapped
ret = await coro(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/workspace/main.py", line 57, in status
character = load_character(ctx.message.author.id)
^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'load_character' where it is not associated with a value
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/runner/workspace/.pythonlibs/lib/python3.11/site-packages/discord/ext/commands/bot.py", line 1366, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/workspace/.pythonlibs/lib/python3.11/site-packages/discord/ext/commands/core.py", line 1029, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/workspace/.pythonlibs/lib/python3.11/site-packages/discord/ext/commands/core.py", line 244, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: UnboundLocalError: cannot access local variable 'load_character' where it is not associated with a value```
Since i just started with coding in general i don't really know what the problem is. Tried asking ai but that also i didn't understand.
So pls. If one of you know what ia have to do, pls help.