I have a python file which looks something like this :
import argparse
parser = argparse.ArgumentParser()
parser.add_argument()
etc...
args = parser.parse_args()
function_one(a=args.a, b=args.b)
function_two(c=args.c, d=args.d, e=args.e)
What I would like to have is the following
import argparse
parser = argparse.ArgumentParser()
parser_one = parser.add_parser(name1)
parser_one.add_argument('--a')
parser_two = parser.add_parser(name2)
parser_two.add_argument('--d')
args = parser.parse_args()
So that args would be something like a dictionary of dictionary and args.name1 would be the usual NameSpace.
This would enable me to divide my parser into subparser, and call the functions with :
function_one(**vars(args.name1))
function_two(**vars(args.name2))
I am aware of the function add_argument_group, but this merges the arguments into one NameSpace after calling parser_args.
And add_subparsers is also not the solution as it is exclusive between subparsers.