Instantiate Foo() class on main click group command by running subcomand with Foo() arguments
问题 I want to run a click subcommand with variadic arguments that are going to be used to instantiate a class Foo(*args) on main() group command in order to create an instance of Foo() to be used by its subcommands so that it aligns with the way click works: $ python foo.py subcommand arg1 arg2 ... argN This question is based on my initial question and @StephenRauch answer. import click class Foo(object): def __init__(self, *args): self.args = args def log(self): print('self.args:', self.args)