I think this can be done if you filter out the elements that are already parts with something similar to this:
if PartUtils.AreElementsValidForCreateParts(doc, wallList):
createParts = PartUtils.CreateParts(doc, wallList)
doc.Regenerate()
The code is from this post: