I am trying to figure out if it is possible to loop over a directory of python scripts and call a specific function I know will be there.
If I have a structure like this
.
└── app dir/
├── app.py
└── scripts/
├── foo.py
├── bar.py
├── 123.py
└── ...
And I know that each file in scripts has a function called getName(), is it possible to loop over them and call that function inside app.py?
At the moment I use a subprocess in app.py to call the scripts and use sys.argv inside the scripts to print the output of functions... I'd rather just call the functions directly if possible.
If it is possible, would I be able to have the scripts directory be "dynamic" where all scripts are imported automatically?