import bpy
for area in bpy.context.screen.areas
: if area.type == 'TIMELINE':
for region in area.regions:
if region.type == 'WINDOW':
ctx = bpy.context.copy()
ctx[ 'area'] = area
ctx['region'] = region
bpy.ops.time.view_all(ctx)
break

for area in bpy.context.screen.areas
: if area.type == 'TIMELINE':
for region in area.regions:
if region.type == 'WINDOW':
ctx = bpy.context.copy()
ctx[ 'area'] = area
ctx['region'] = region
bpy.ops.time.view_all(ctx)
break
