How to use variables in a top-level file?

Gradle v2.9.x (old I know, but that’s another project)

I tried the solution suggested in gradle: how to access the from another project to no avail.

I want to define artifact versions on a top-level file like so

toplevel/ file:

Then I want to be able to use the above variable in artifact1_version variable like so

toplevel/artifact1/ file:

Is this possible to do in Gradle? If so how?