You could use methods from Object class
I suppose it's not exacly what do you want but you can do this
if not body.get(SomeVariable) == null:
# body has variable
However if you set SomeVariable
to null this code will think that body don't have this variable.
As workaround you could use dummy setget
getter for SomeVariable
and has_method()
function
#body
var SomeVariable setget SomeVariable_get
func SomeVariable_get():
return SomeVariable
# somewhere else
prints(body.has_method("SomeVariable_get") # true