When you add a script to the bin/ directory, it is added to the $PATH within the process. This means those scripts become executable directly, as if they were available on the command line.
However, there’s no guarantee that the paths symlinked into bin/ will also be staged. In fact, I don’t think there’s any way for Nextflow to know it should symlink additional paths.
Then there’s the complication of Python import paths, which may or may not resolve correctly. It’s hard to tell from your example, but I can’t imagine it working reliably when using an absolute path to the Python file.
Additionally, your predict.sh script calls a hardcoded path, which is almost certainly going to fail. I’d recommend calling predict.py directly instead.
Move the files directly into the bin/ directory - no need to symlink them.
Add a Python shebang to predict.py if it doesn’t already have one (e.g., #!/usr/bin/env python3).
Replace predict.sh by calling predict.py directly: