# Import 'fun' from other file

**URL:** <https://discuss.kotlinlang.org/t/import-fun-from-other-file/26991>\
**Category:** Uncategorized\
**Created:** [June 23, 2023, 3:58pm UTC](https://discuss.kotlinlang.org/t/import-fun-from-other-file/26991 "2023-06-23T15:58:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fornakter](https://avatars.discourse-cdn.com/v4/letter/f/a6a055/32.png) [@fornakter](https://discuss.kotlinlang.org/u/fornakter)\
**Post date:** [June 23, 2023, 3:58pm UTC](https://discuss.kotlinlang.org/t/import-fun-from-other-file/26991/1 "2023-06-23T15:58:28Z")

</div>

Hi.  
How can i use/import functions from other file, example:

prnt.kt

> fun prnt(txt: String)  
> {  
> println(“$txt”)  
> }

Main.kt

> fun main(args: Array) {  
> println(“Hello World!”)  
> // prnt.kt.prnt(“Another Hello World”)  
> }

---

<div class="post-metadata">

**Author:** ![broot](https://avatars.discourse-cdn.com/v4/letter/b/a88e57/32.png) [@broot](https://discuss.kotlinlang.org/u/broot)\
**Post date:** [June 23, 2023, 4:23pm UTC](https://discuss.kotlinlang.org/t/import-fun-from-other-file/26991/2 "2023-06-23T16:23:39Z")

</div>

If it is in the same package, then simply: `prnt()`.

---

<div class="post-metadata">

**Author:** ![fornakter](https://avatars.discourse-cdn.com/v4/letter/f/a6a055/32.png) [@fornakter](https://discuss.kotlinlang.org/u/fornakter)\
**Post date:** [June 23, 2023, 4:45pm UTC](https://discuss.kotlinlang.org/t/import-fun-from-other-file/26991/3 "2023-06-23T16:45:37Z")

</div>

Ok, it works 🙂  
But how about when a file (ex. prnt.kt) its on other folder?

---

<div class="post-metadata">

**Author:** ![ebrowne72](https://avatars.discourse-cdn.com/v4/letter/e/85f322/32.png) [@ebrowne72](https://discuss.kotlinlang.org/u/ebrowne72)\
**Post date:** [June 23, 2023, 6:14pm UTC](https://discuss.kotlinlang.org/t/import-fun-from-other-file/26991/4 "2023-06-23T18:14:37Z")

</div>

```auto
import com.other.package.prnt

```
