Can't set the value of a 3D Widget variable

It’s a bit of an old thread, but I’ve come up with a solution that can be very useful to everyone.
I hope that will be useful.