How to call other gradle file define method?

I have Android projects residing in this kind of folder structure (I have flattened the structure, because i am not sure how to format it with ASCII-Code in this editor):

/myapplication/build.gradle
/myapplication/app/build.gradle

i define a class Version

class Version {
def versionCode
def versionName
}

at app/build.gradle

i can use

Version readVersionWithPath(String version_properties_path) {

Properties defaultVersionProps = new Properties()
def pfile = file(version_properties_path)
if (!pfile.exists()) {
    pfile = file('version.properties')
}
defaultVersionProps.load(new FileInputStream(pfile))
def defaultBuildVersionCode = defaultVersionProps['VERSION_CODE']
def defaultBuildVersionName = defaultVersionProps['VERSION_NAME_PREFIX'] + "." + defaultVersionProps['VERSION_NAME_BUILD']
return new Version(versionCode: defaultBuildVersionCode, versionName: defaultBuildVersionName)

}

to get version

and use

def increaseVersionWithPath(String version_properties_path) {
Properties versionProps = new Properties()
def pfile = file(version_properties_path)
if (!pfile.exists()) {
pfile = file(‘version.properties’)
}
versionProps.load(new FileInputStream(pfile))
def hotfix = versionProps[‘VERSION_NAME_HOTFIX’].toInteger()
def nextCode = versionProps[‘VERSION_CODE’].toInteger() -hotfix + 10
versionProps[‘VERSION_CODE’] = nextCode.toString()
def nextBuild = versionProps[‘VERSION_NAME_BUILD’].toInteger() + 1
versionProps[‘VERSION_NAME_BUILD’] = nextBuild.toString()
hotfix = 0
versionProps[‘VERSION_NAME_HOTFIX’] = hotfix.toString()
versionProps.store(pfile.newWriter(), null)
def buildVersionName = versionProps[‘VERSION_NAME_PREFIX’] + “.” + versionProps[‘VERSION_NAME_BUILD’]
println “Increase $buildVersionName”
}

task increaseVersion {
doLast {
increaseVersionWithPath(‘version.properties’)
}
}

to increase Version

now i want export version let other project can re-use !!

so i export define class & method to version.gradle

/myapplication/app/version.gradle

but !! now

i can not access class & method ??

can help me ? how to do ?

THX