Import class in another gradle file not working

I have the following dependency in build.gradle file:

buildscript {
    dependencies {
        classpath 'commons-codec:commons-codec:1.10'
    }
}

Then I have the following apply from in the same build.gradle file:

apply from: rootProject.file('gradle/another.gradle')

In the gradle/another.gradle file I have the following:

import org.apache.commons.codec.digest.DigestUtils
task renameCssToChecksums(type: Copy) {
    from "$buildDir/css"
    into 'webapp/css'
    rename { String cssFileName ->
        String checksum;
        File cssFile = file("$buildDir/css/" + cssFileName)
        cssFile.withInputStream { ins -> checksum = DigestUtils.md5Hex(ins) }
        return checksum + '.md5.css'
    }
}

When I try to build it I get the following error:

gradle/another.gradle': 1: unable to resolve class org.apache.commons.codec.digest.DigestUtils
   @ line 1, column 1.
     import org.apache.commons.codec.digest.DigestUtils
     ^

When I move all contents of gradle/another.gradle to main build.gradle file - everything works perfectly. The problem is with the import in another gradle file.

So I guess the question is how to add the dependency or import properly in the gradle/another.gradle file?

You may want to follow this topic because problem is same: Use multiple Gradle files