Functions in Python script

Hi guys!
I want to calculate area for substrate and finish function. And volume for the remaining functions. Is there a way I can do it in a python script?
Also, I have tried to group my function using GroupByFunction node, but it doesn’t group them.