You could do it like this.
Create your scene Foo and attach a script foo.gd.
# foo.gd
class_name Foo extends Node2D
var number := 42

Autoload the scene with a different node name (Bar).

And then you can access your node for example in your main scene.
func _ready() -> void:
print(($/root/Bar as Foo).number)
var my_foo: Foo = $/root/Bar
print(my_foo.number)
But again, I don't really know why you'd want to do that.