This function is supposedly the one for fitting the camera to 3D view with python(with mouse cursor hovering over the 3d view):
import bpy
for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
if bpy.ops.view3d.view_center_camera.poll()
bpy.ops.view3d.view_center_camera()
Hitting home keyboard-button activates view_center_camera function and does what it is supposed to, so the function seems correct and working.
It just doesn't work when I call the function from Python(like mentioned above). What is the correct way?
bpy.ops.view3d.view_center_camera()
. $\endgroup$