This is a minor nit, but why is OP's script a Python script with a .sh extension? I know the extension doesn't "matter", but if I see a .sh extension I'm expecting a Bash script.
Dont quote me on the specifics though, and honestly why it can't _just_ be a python file I couldn't tell you, claude code can very much run a python <filename> but maybe thats what the author tried to avoid (or the llm).