are not available when applying external script in buildscript

I tried this solution with an external script but I too get the error that my property is not defined:


dependencies {
    classpath "${pluginVersion}"


buildscript { 
    apply from: "buildscript.gradle", to: buildscript


When running:

> gradle tasks

FAILURE: Build failed with an exception.

* Where:
Script '/Users/levsa/tmp/foo/buildscript.gradle' line: 2

* What went wrong:
A problem occurred evaluating script.
> Could not find property 'pluginVersion' on org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated@24d3e83f.

Continuing the discussion from Inherit / inject buildscript dependencies into custom script within subproject:

The example above (from Peter) does not work.