With the context added in your comment, your question makes more sense. Yes, you can set any attribute of an object in another method. Actually, due to Python's dynamic typing, you can set them even after your object has been initialized:
class Example:
pass
e = Example()
e.foo = 'bar'
e.foo # returns 'bar'
Generally, however, you want to initialize all attributes of an object in its __init__ method, because it's easier to maintain, and you always know where to look when you don't remember whether a particular attribute is defined or where it came from.
In your example, it makes more sense to initialize your class with all attributes it will ever have, and then call methods to modify them. For example:
class Button:
def __init__(self):
*snip*
self.active = False
self.color = 'red'
self.linewidth = 2
def activate(self):
self.active = True
self.color = 'green'
self.linewidth = 5
def deactivate(self):
self.active = False
self.color = 'red'
self.linewidth = 2
Now you probably noticed that we have code duplication - the __init__ method basically copies the lines in the deactivate method! Still, it's great for readability to have all attributes in the __init__ method. What do we do?
Consider this compromise: initialize all attributes with None values, and then call the deactivate method:
class Button:
def __init__(self):
*snip*
self.active = None
self.color = None
self.linewidth = None
self.deactivate()
def activate(self):
self.active = True
self.color = 'green'
self.linewidth = 5
def deactivate(self):
self.active = False
self.color = 'red'
self.linewidth = 2
This combines the best of both worlds: our code is readable (the __init__ method basically reads "initialize a button with these attributes and then deactivate it"), but also suffers from no code duplication.
This question adds some further insights on why it's preferable to create all attributes in the __init__ method.
self.active = Falsein the init method?