How to get the geometry info from commit by python?

I think there is just a little variable naming conflict going on there. See two approaches below, the first one uses the variable name flattened_base and the second flatten_base. This should highlight the conflict in naming being the same as the function.

Try assign the result of the method in line 12 to something other than flatten_base which is in your snip the same as the method name.