When I run this code in Blender 3.4.1 as you specified it does in fact replace the cube with a point light. Thank you for the helpful code! How could I achieve the same effect but by object type instead of name?