I think you don’t understand me. There is no such thing “it does not work”.
Imagine yourself seeing a doctor because you’re unwell. He asks you various question to understand what’s the reason but all you say to him is “I AM UNWELL, PLEASE HELP ME”.
Please read this before we carry on.
It gets a payload variable that HA put into special data dictionary used to pass service data to python_scripts. That payload variable is formed when HA finds payload: blah inside service data (data or data_template).