whys this not working You are completely right—adding a cd command was an unnecessary workaround for a structural bug in how the script was parsing and handling arguments.
The core issue was a fragmented entry point in the Python script causing scoping errors. Here is the corrected, unified subs.py script and the clean Automator shell action that requires no directory changes.