Is there a way to create a new Material with Material Function on it?

I have an actor which is used for every object which is interactable, but to indicate on player the specific object, i want to flash the static mesh with light. I managed to do it manually by creating 2 Material functions (One which is the parent and the other is the light functionality) and using them on a Material with a simple BlendLayer node. Though is there a way to use only the material that is already used in the StaticMesh and create a new MaterialInstance by referencing the light functionality? What I want:

// Header file
        // Flashing Item functionality 
	UPROPERTY(EditAnywhere)
	class UMaterialFunctionInterface* MaterialFunction;

        // For future use. For example if i want to stop flashing item using Material Parameters.
	UPROPERTY()
	class UMaterialInstanceDynamic* MaterialInstance;

// CPP file

        UMaterialInterface* ParentMaterial = ItemMesh->GetMaterial(0);
	
	MaterialInstance = UMaterialInstanceDynamic::Create(ParentMaterial, this);

	// Add the material function as a material layer
	MaterialInstance->AddMaterialFunction(MaterialFunction);

	ItemMesh->SetMaterial(0, MaterialInstance)

The Flashing Material Function: