0
cant get a variable to pass back to the main function in python
in my d&d 5e game when choosing a background for the character I call a fuction because it seemed easier at the time now i cant get the variable of background to pass back to the main function ill leave a link with the part of the main function that is in question and a sample of the function it is calling https://code.sololearn.com/c16WHT5n1jGP/#py
4 odpowiedzi
+ 2
You need to call the function in order to get it to operate upon the contents.
Maybe you could set up separate functions to run the details of each of your character classes, and use the main() to control the selection flow.
+ 1
I had a quick look at your sample.
First thing I noticed was the main() function was not being called.
Then I started to get an error stating Classs was not defined, which may tie back to a previous section of your code.
Good luck
+ 1
Rik Wittkopp that is only a small sample of a bigger program I just wanted to highlight the problem areas I could post the whole code but it won't run in the playground. If I call back the main() function wouldn't that send me back to the top of the program? The function and variable in question are about 100 lines into the program
+ 1
Rik Wittkopp I'll look into that thank you