2👍
✅
Of course, just overwrite the init method:
class YourCommand(BaseCommand)
def __init__(self, stdout=None, stderr=None, no_color=False):
super().__init__(stdout, stderr, no_color)
self.your_var = ''
def handle(self, *args, **kwargs):
... logic goes here ...
BaseCommand is just a Plain old Python Object.
Source:stackexchange.com