trouble with callback-methods of UI-elements on Instantiating via script

Hello Community,
I have the following problem: i want to instantiate a UI-prefab, which has some predefined Callback-methods.
imagine a prefab with a UI-Button with an Onclick() method. the moment i instantiate the prefab in runtime, the method call in the UI-Button is empty… do i have to assign the method calls while instantiating or how is it done else?

thank you in advance! if somethings unclear, please be welcomed to ask:)

To add an event to an Object that implements one of the UnityEvents, you simply need to use the AdListener method, for example on a button you would:

myButton.onClick.AddListener(() => Debug.Log("The Button was clicked"));

Hope this helps. Although code attached events will not appear in the editor!

thanks, havent tried yet, but i will try to report asap:)