Hi, Im trying to run my magic 8 ball generator app, but it is saying “NameError: name ‘self’ is not defined” In python
Please tell me the issue thx.
Hi, Im trying to run my magic 8 ball generator app, but it is saying “NameError: name ‘self’ is not defined” In python
Please tell me the issue thx.
You are using self outside of the Form’s class, that’s the issue.
In python the indentation level is important.
The last block of lines is not indented, so it’s executed only once, when the module is imported.
If you indent it 4 spaces, it will belong to __init__
and will be executed every time the form is created, and self
will refer to the form being created.