Text inside a Label is incorrectly formatted until reloading the scene

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

Hey guys, so the thing goes like this:

I’m creating an app that generates a UI (mostly buttons) out of a .json file.
These buttons are created using a TextureButton that has a Label as a child.
When I create the button, I update the Label text like this:

func create_button(button_name, button_parent):
var button = button_template.instance()
button.show()
button.get_node("Label").text = str(button_name)
button.name = str(button_name) + "Button"
container.call_deferred("add_child", button)
print(button_parent.name)
if "button_children" in button_parent:
	button.hide()
	button_parent.button_children.append(button)
else:
	first_breadcrumb.button_children.append(button)
connect_signal(button, null, button_parent)
unpack_data(pepito, button)

Notice the button.get_node(“Label”).text = str(button_name) line

The thing is, the first time I use button.show() function in the app, the text in the Label doesn’t look good. As soon as I reload the scene, the text corrects itself.

Attaching a video and some images that also show the scene setup for the button.

Does anybody know why this happens? And if there’s a way to fix it?