This is probably a dumb question, but I have a python script that accepts a bunch of arguments using argparser, and I would like to load this script as a module in another python script, which is good. But I'm not sure how to call the module, since no function is defined; can i still call it the same way i do if i just call it from cmd?
Here is the child script:
import argparse as ap from subprocess import Popen, PIPE parser = ap.ArgumentParser( description='Gathers parameters.') parser.add_argument('-f', metavar='--file', type=ap.FileType('r'), action='store', dest='file', required=True, help='Path to json parameter file') parser.add_argument('-t', metavar='--type', type=str, action='store', dest='type', required=True, help='Type of parameter file.') parser.add_argument('-g', metavar='--group', type=str, action='store', dest='group', required=False, help='Group to apply parameters to')
and here is the parent script that I want to call from the child script; it also uses arg analyzer and executes some other logic
from configuration import parameterscript as paramscript
Inside the configuration directory, I also created an init .py file that is empty.
source share