You can do it using setters/getters, like so:
var my_good_private_x = 6 setget private_gs,private_gs
var my_better_private_y = 9 setget private_gs,private_gs
func private_gs(val = null):
# Using a default value to make it possible to call with both 1 and 0 arguments (e.g. both as setter and getter)
print("Access to private variable!!!")
print_stack()
pass # No set, no get for you!
# Usage:
func _ready():
my_good_private_x = 54 # works!
print(my_good_private_x) # 54
self.my_better_private_y = 23 # migth work, depends on which version of godot you use