reinitialize every script of the program

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By kietjay123

i have a func here that will be call with x being the root node

for i in range(0 , x.get_child_count()) :
	var a = x.get_child(i)
	if a.get_child_count() != 0 :
		cleanup(a)
	if a.get_script() != null :
		var b = a.get_script().duplicate()
		a.set_script(b)

but when ever i call it the program just stop debugging, if i try replace x with a lower tier node it will crash but doesnt stop the debug but will give

 Resource file not found: res://.

this error. this function is place in the root node script and . Any help would be great