Need help dividing existing Parts into more parts

Hello! New Dynamo user here. I took the existing code from here (Dividing parts with dynamo - #36 by JacobSmall) and modified it a bit to suit my needs. The problem I’m running into now is that I need to select an existing Part instead of an existing Wall. I changed the dynamo part of it to do what I need, but I’m getting stuck on what to do with the Python Script.

It keeps giving me the error:
“Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 23, in
TypeError: iteration over non-sequence of type NoneType”

I know it has something to do with the script calling for a wall but I’m not sure where the edits need to take place. I can get the lines to divide the parts where I need but it fails dividing it.

here is the .dyn:

Any help would be appreciated! Thanks.

Have you resolved this?

I have not! Deadlines came up and I had to stop working on it but I would still like to resolve it

Have seen this post?