Let's say I have two modules:
a.py:
import argparse parser = argparse.ArgumentParser() parser.add_argument("arg", help="Some argument") args = parser.parse_args() def func(): print('Hello world!')
b.py:
from a import func func()
When I execute python3.8 '/home/b.py'
I got
usage: b.py [-h] arg
b.py: error: the following arguments are required: arg
...even though func
doesn't need to use system arguments to be executed
Is there any way I can import and execute func
without passing system arguments to b.py
?