When you run a Python script in the background using & in a shell script, Python ignores the SIGINT signal (which is usually triggered by pressing Ctrl+C) because it inherits a setting from the shell that tells it to ignore this signal.
In a shell script, job control is usually disabled by default. This means that any process started in the background inherits the behavior of ignoring SIGINT and SIGQUIT signals. As a result, the Python script does not set its usual handler for SIGINT, which would raise a KeyboardInterrupt. Instead, it keeps the ignore setting.
If you want Python to respond to SIGINT while running in a shell script, you can enable job control by adding set -m at the beginning of the script. This will allow the Python script to set its default handler for SIGINT, so it can respond to the signal as expected.