Just call the scenetree_json once and save the result, like

```python
json = p.scenetree_json()
return BoxGeometry(width = json['size'][0], height=json['size'][1], depth=json['size'][2])
```