Skip to content

How can I add variables in my class? #2083

Closed Locked Answered by JustaSqu1d
ntosis asked this question in Q&A
Discussion options

You must be logged in to vote

To start off, the GitHub discussions tab is not intended for help-related questions: please ask in our Discord server, instead.

Assuming that the indentation is correct, self.list_with_draft_channels will not work because self is not defined. self is used to refer to the object of the creation, however, outside of the class, you would use the variable that refers to the object itself (in this case, bot).

As a result, you can use the object to access its attribute: bot.list_with_draft_channels.

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by JustaSqu1d
Comment options

You must be logged in to vote
1 reply
@JustaSqu1d
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants