Hi,
I have recently been looking at using fastcore.script as a way to create lightweight scripts around functions which are also imported and used elsewhere. However, I seem to be experiencing some odd behaviour, which I will illustrate with a trivial example.
Let’s say I define a script say_hello_script.py
which contains:
from fastcore.script import *
@call_parse
def say_hello(greeting: Param('Greeting', str) = 'Hello',
name: Param('Name', str) = 'World'):
print(f'{greeting}, {name}')
If I call this from the command line using python say_hello_script.py --name Chris
, I get the expected output of Hello, Chris
. All is good so far.
However, now I want to call this function from a different script, so I will create a script greeter.py
which contains:
from say_hello_script import say_hello
if __name__ == '__main__':
say_hello(greeting='hi', name='person')
Running python greeter.py
I get the output of Hello, World
, which seems to have bypassed my arguments! Is this the normal behaviour?
Thanks,
Chris