How can I call nested click commands from other Python applications? #2814
Unanswered
and-viceversa
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hopefully I didn't miss something obvious.
I've got a standard Click application with one
Groupand several nested commands.my_group->
sub_command_one->
sub_command_two->
sub_command_threeNow that this application is looking good, I've got the idea to call these subcommands from other (non-Click) Python tools. I can call these sub commands directly through a typical module import, but that omits the
Groups's contextctxfrom transferring down to the child. So any options and arguments etc that apply to the Group are not passed to the children. The childctxis a NoneType.What am I missing here? Is there an idiomatic way to call nested commands arbitrarily from other Python code?
Edit: Calling the original Click application via
subprocessor similar is not desirable, because I'd like to use the Click command's return values in the calling application.Beta Was this translation helpful? Give feedback.
All reactions