Command-substitution
Command substitution replaces itself with the internal command.
python script.py --secret_key "$(cat ~/.secret_key)"
Alternatively, process substitution can be used to instead create a temporary file with the contents of the command, and then return the file path.
python script.py --file <(python generate_key.py)