Hi try to use:
return "Text warning" if ...
an example form a tutorial, they need to call a function(by pressing a button) to change the level but the level needs to be uploaded on the variable in the inspector.
func onbuttonup() -> void:
func getconfigurationwarning() -> String:
return "The property Next Level can't be empty" if nextscene_path == "" else ""
the tutorial on divided in 3 parts and is on YouTube, don't remember which one was, hope it helps.