To interactively test my python script, I would like to create a Namespace object, similar to what would be returned by argparse.parse_args(). The
Namespace
argparse.parse_args()
argparse documentation show various examples of what you're trying to do:
import argparse parser = argparse.ArgumentParser() parser.add_argument("-a") parser.parse_args(['-a 12']) >>> Namespace(a=' 12')