Blender interface is not perfect from the API point of view and unfortunately this is the part of the program that is not subject to frequent updates. Sometimes to manipulate the panels we have to make some efforts including delays so that blender does not crash. This does not always occur and we were not able to find out what the reason is even on the blender developer forums. But I thank you for the feedback and I will definitely check if there have been any recent updates that may affect this.