How to ensure code runs at the proper point in inherited scripts

Godot Version



I want to make a script for simple cutscenes (move 2D characters around, display text, that kind of thing). I have a “CutsceneManager” script with the following code:

class_name CutsceneManager

extends Node

var cutscenes: Dictionary = {}

func _ready():
	for i in get_children():
		if i is Cutscene:
			cutscenes[] = i

func play(cutscene: String):
	Events.is_in_cutscene = true
	var cutscene_to_play = cutscenes.get(cutscene)

and I want to make a simple cutscene script for all of my real cutscenes to inherit from. I want all of them to look something like this:

class_name Cutscene

extends Node

func run():
	#some cutscene code here
	Events.is_in_cutscene = false

is there a way to set up inheritance so that the run function will always set the is_in_cutscene variable to false on the last line, no matter what other code I put into the inherited cutscene scripts? Or would I be better off just making sure to always manually add that as the last line.