I have train.py file without a class, just a list of functions. In the beginning after the import statements there are lines:
parser = argparse.ArgumentParser(description='PyTorch ImageNet Training')
parser.add_argument('data', metavar='DIR',
help='path to dataset')
parser.add_argument('--model-dir', type=str, default='',
help='path to desired output directory for saving model '
'checkpoints (default: current directory)')
parser.add_argument('-a', '--arch', metavar='ARCH', default='resnet18',
choices=model_names,
help='model architecture: ' +
' | '.join(model_names) +
' (default: resnet18)')
I placed this file in the folder of the second py file app.py and want to run it from app.py
import train as train
Usually train.py is called from command line as:
train.py --model-dir="sdcsdc" --batch-size=333 .... path_to_datafolder
but i should call this file from app.py. How can i import this train.py file and set arguments inside app.py?