Make a Python function available in Calc, run it against the open spreadsheet, and troubleshoot missing macros or imports ...
Without functions all we have are attributes of objects. Functions are where variables live. This extract from Programmer's Python: Everything is an Object explains that functions bring something new ...