# How to use class from another script

**URL:** <https://discuss.gradle.org/t/how-to-use-class-from-another-script/11112>\
**Category:** Help/Discuss\
**Created:** [August 11, 2015, 3:33pm UTC](https://discuss.gradle.org/t/how-to-use-class-from-another-script/11112 "2015-08-11T15:33:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![d\_sauer](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/d_sauer/32/2395_2.png) [@d\_sauer](https://discuss.gradle.org/u/d_sauer)\
**Post date:** [August 11, 2015, 3:33pm UTC](https://discuss.gradle.org/t/how-to-use-class-from-another-script/11112/1 "2015-08-11T15:33:36Z")

</div>

Is it possible to share class/enum with some static values from one Gradle script into another Gradle script?

For example would like to have one Gradle script with some commons methods, which are stored inside class of build script.  
And I would like to use those methods by importing that script into another script.

I tried with:

```
buildscript {
  apply from: "commonScript.gradle"
}

```

Is there some other way, or this is not possible to do with script?  
At the moment I’m trying to avoid to create plugin or use buildSrc, because current scripts are small. But will be nice to share some commons.

---

<div class="post-metadata">

**Author:** ![Francois\_Guillot](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/francois_guillot/32/8566_2.png) [@Francois\_Guillot](https://discuss.gradle.org/u/Francois_Guillot)\
**Post date:** [August 11, 2015, 8:08pm UTC](https://discuss.gradle.org/t/how-to-use-class-from-another-script/11112/2 "2015-08-11T20:08:34Z")

</div>

IMHO You shouldn’t be afraid to write a plug-in, even for small basic things.  
That’s the cleanest thing to do.  
I’m sure you will be tempted to share more things through it in the future. You’ll be glad to have it then.

---

<div class="post-metadata">

**Author:** ![d\_sauer](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/d_sauer/32/2395_2.png) [@d\_sauer](https://discuss.gradle.org/u/d_sauer)\
**Post date:** [August 12, 2015, 6:57am UTC](https://discuss.gradle.org/t/how-to-use-class-from-another-script/11112/3 "2015-08-12T06:57:35Z")

</div>

Hi, I’m not afraid to write plugin 🙂  
At the moment we want to use it as a script. In near future I’m planing to convert those scripts to plugins.
