I'm trying to recreate the camera as a mesh in python
this script work pefectly

import bpy, bmesh, math
deleted = [ob for ob in bpy.context.scene.objects if ob.name =='SCATTER:[Active Cam Boolean]'];bpy.ops.object.delete({"selected_objects": deleted})

if bpy.context.scene.camera == None:
    bpy.ops.object.camera_add(align='VIEW',location=(0,0,0),rotation=(1.5708,0,0))
    bpy.context.scene.camera = bpy.context.view_layer.objects.active

CAM = bpy.context.scene.camera
bpy.context.view_layer.objects.active = CAM
FOV = bpy.context.object.data.angle
bpy.context.scene.cursor.location = CAM.location #

bpy.ops.mesh.primitive_cube_add(size=2)
BOOL = bpy.context.object
BOOL.rotation_euler=CAM.rotation_euler
BOOL.name = BOOL.data.name = "SCATTER:[Active Cam Boolean]"
BOOL.display_type = 'WIRE'
BOOL.hide_render = True
cy=BOOL.cycles_visibility ;cy.camera=cy.transmission=cy.diffuse=cy.scatter=cy.glossy=cy.shadow= False

bpy.ops.object.editmode_toggle()
bpy.ops.mesh.select_all(action='DESELECT')
mesh = bmesh.from_edit_mesh(BOOL.data)
for f in mesh.faces:
    if f.index ==5:
        f.select = True
bpy.ops.mesh.select_mode(type='EDGE') ; bpy.ops.mesh.select_mode(type='FACE')
bpy.ops.mesh.merge(type='CURSOR')
bpy.ops.object.editmode_toggle()

bpy.ops.object.transform_apply(location=0,rotation=0,scale=1)#=FFT
bpy.context.object.scale[2] = 1/math.tan(FOV/2)

CAM.select_set(state=True)
bpy.context.view_layer.objects.active = CAM
bpy.ops.object.parent_set(type='OBJECT', keep_transform=True)
for i in range(0,3): BOOL.lock_rotation[i] = BOOL.lock_location[i] = True

dimension_x = bpy.context.scene.render.resolution_x /1000
dimension_y = bpy.context.scene.render.resolution_y /1000
BOOL.dimensions.xy = (dimension_x,dimension_y) #to get correct ratio

if dimension_x&gt;dimension_y:
    divider = 2/dimension_x
else:
    divider = 2/dimension_y
BOOL.scale.xy = (BOOL.scale.x*divider,BOOL.scale.y*divider)