From the screenshot you provide, it seems that you are using Allplan 2021-0-6 or 2021-0-7. We tested from our side we don't have such an issue.
Could you please provide some information from Allplan trace? Normally, if something goes wrong, it will provide some addtional information about the problem. Allplan trace can be opened from Allplan Services. (see attached screenshot)
Apart from that, could you try following to check, if it helps/works?
- run the script directly from Allplan library, or
- reload the project or drawing file after save the PythonPart (vs) object