Question was answered by googling...
It is best to use json node
[{"id":"45771f1f.8f26e","type":"function","z":"8397e515.d35b18","name":"","func":"a ={};\na.val1=1;\na.val2=2;\n\nmsg.payload=a;\nreturn msg;","outputs":1,"noerr":0,"x":233.16669464111328,"y":432.66666984558105,"wires":[["572f1be0.01ef04"]]},{"id":"c0f867b2.7f5698","type":"inject","z":"8397e515.d35b18","name":"","topic":"","payload":"KarolisL","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":136.00000762939453,"y":345.00000953674316,"wires":[["45771f1f.8f26e"]]},{"id":"d7e850ac.ed588","type":"debug","z":"8397e515.d35b18","name":"","active":true,"console":"false","complete":"false","x":614,"y":345,"wires":[]},{"id":"d74a5980.dd7fe8","type":"pythonshell in","z":"8397e515.d35b18","name":"","pyfile":"C:\\Users\\KL\\PycharmProjects\\TEST\\debug.py","virtualenv":"","continuous":false,"stdInData":false,"x":404,"y":345,"wires":[["d7e850ac.ed588"]]},{"id":"572f1be0.01ef04","type":"json","z":"8397e515.d35b18","name":"","property":"payload","action":"str","pretty":true,"x":392.16668701171875,"y":446.66668701171875,"wires":[["d74a5980.dd7fe8"]]}]
Answered in Passing JSON object (as string) to python script (exec node)