EditorPlugin related problem

Godot Version 4.2

Question

hello everyone,i run into a trouble that when i add_child in editorplugin type script,the custom function could not be recognized,and it will occur an error like “res://scene/GameScene/Tool/Script/AutoConstantGenerator.gd:38 - Invalid call. Nonexistent function ‘preLoad’ in base 'Node (BattleCharacterNodeGenerator.gd)”

and in contrast,when i run same function after i ran project,i can perform function successfully.idk why.could anyone give me an answer or solution?

my function code is here:

@tool
extends Node
const SpellConstantGenerator = preload("res://scene/SpellSystem/Tool/Script/SpellConstantGenerator.gd")
const ElementConstantGenerator = preload("res://scene/ElementSystem/ElementConstantGenerator.gd")
const BattleBuffConstantGenerator = preload("res://scene/BattleScene/script/BattleBuffSystem/Tool/Script/BattleBuffConstantGenerator.gd")
const BattleAIConstantGenerator = preload("res://scene/BattleScene/script/BattleAISystem/Tool/BattleAIRegister.gd")
const BattleEventConstantGenerator = preload("res://scene/BattleScene/script/BattleEventSystem/Tool/Script/BattleEventConstantGenerator.gd")
const BattlerInitInfoConstantGenerator = preload("res://scene/BattleScene/BattleCharacterPreset/Script/BattlerInitInfoConstantGenerator.gd")
const BattlerFormConstantGenerator = preload("res://scene/BattleScene/BattlerFormPreset/Tool/Script/BattlerFormConstantGenerator.gd")
const BattleCharacterNodeGenerator = preload("res://scene/BattleScene/BattleCharacterPreset/Script/BattleCharacterNodeGenerator.gd")

const GeneratorNode = preload("res://scene/GameScene/Tool/Script/GeneratorPrototype.gd")

const BattlerFormConstantGeneratorTSCN = preload("res://scene/BattleScene/BattlerFormPreset/Tool/SceneFile/battler_form_constant_generator.tscn")
const BattleCharacterNodeGeneratorTSCN = preload("res://scene/BattleScene/BattleCharacterPreset/Script/ToolSceneFile/battle_character_node_generator.tscn")

var generatorArray:Array = []
signal load_complete

func _ready():
    # preLoad()
    pass

func _enter_tree():
    preLoad()

func preLoad():
    generatorArray.append(SpellConstantGenerator.new())
    generatorArray.append(ElementConstantGenerator.new())
    generatorArray.append(BattleBuffConstantGenerator.new())
    generatorArray.append(BattleAIConstantGenerator.new())
    generatorArray.append(BattleEventConstantGenerator.new())
    generatorArray.append(BattlerInitInfoConstantGenerator.new())
    generatorArray.append(BattlerFormConstantGenerator.new())
    execute()
    var battleCharacterNodeGenerator:BattleCharacterNodeGenerator = BattleCharacterNodeGeneratorTSCN.instantiate()
    battleCharacterNodeGenerator.preLoad()
    execute()
    load_complete.emit()

func execute():
    for script in generatorArray:
        script.preLoad()
    generatorArray.clear()

func addNode(node:Node):
    add_child(node)
    generatorArray.append(node)

engine told me BattleCharacterNodeGenerator dosent have preLoad function,but when game is running,this problem dosent exist