Passing (msg.payload) in exec node to a python script function

How can we possibly know what is not right if you don't show us what you are doing and tell us what happens (or doesn't happen)?
Post a small flow showing your attempt, possibly an inject node to trigger it and then your nodes to call the script, plus the python script itself.
A question though, where do you expect the script to print to?

For posting your flow see How to share code or flow json