Change element inner text in other scene not working

I have two scenes. A & B.
I have a function executed while A appears. Let’s name it changeText().
the function load data from api and change a text element in scene B. In chrome’s console, I can see that the element’s text are changed to what i want.
But when I slide from A to B, the element’s inner text is restored. Like it have never been changed.
How can I solve this problem?

The contents of a scene’s element are reset when loading a scene (or during the start point of a transition), so you would need make sure that you run this function ‘on scene load’ for scene B.