get_stack()
will get you all the information you need in regards to the call stack. This function was intended for debugging. A function should not rely on knowing who calls it to execute.
If you are wanting to do some setup when called from _ready()
but not when called from _process()
there are much better ways:
var my_member_variable
func _ready():
setup_for_my_shared_function()
my_shared_function()
func _process():
my_shared_function()
func setup_for_my_shared_function()
my_member_variable = ["foo", "bar"]
func my_shared_function()
var a = my_member_variable[0] + " now i'm doing the rest"
var bar = my_member_variable[1]
my_member_variable = ["bar", "baz"]
Alternatively:
var my_cool_variable
func _ready():
my_shared_function()
func _process():
my_shared_function()
func my_shared_function()
if not my_cool_variable:
my_cool_variable = "is now setup"
var i = "now i'm doing the rest" + my_cool_variable