This function is supposedly the one for fitting the camera to 3D view with python(with mouse cursor hovering over the 3d view):
for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
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?