# Why I can't access a function in another file?

**URL:** <https://forum.developer.roku.com/t/why-i-cant-access-a-function-in-another-file/6522>\
**Category:** Archived\
**Tags:** roku-developer-program\
**Created:** [August 25, 2017, 2:19pm UTC](https://forum.developer.roku.com/t/why-i-cant-access-a-function-in-another-file/6522 "2017-08-25T14:19:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![neowinston](https://avatars.discourse-cdn.com/v4/letter/n/f04885/32.png) [@neowinston](https://forum.developer.roku.com/u/neowinston)\
**Post date:** [August 25, 2017, 2:19pm UTC](https://forum.developer.roku.com/t/why-i-cant-access-a-function-in-another-file/6522/1 "2017-08-25T14:19:15Z")

</div>

I’m trying to access a function in another file, but I’m getting the error:

```auto
Function Call Operator ( ) attempted on non-function. (runtime error &he0)

```

The function is located on the **Main.brs.** Even if the files are in the same folder I can’t access the function. What is happening? How do I fix this? Thanks for your help!

---

<div class="post-metadata">

**Author:** ![joetesta](https://avatars.discourse-cdn.com/v4/letter/j/85e7bf/32.png) [@joetesta](https://forum.developer.roku.com/u/joetesta)\
**Post date:** [August 25, 2017, 11:15pm UTC](https://forum.developer.roku.com/t/why-i-cant-access-a-function-in-another-file/6522/2 "2017-08-25T23:15:50Z")

</div>

usually you would have the scripts in another file (although usually not Main, not sure how that would work out)  
But yes, put your function in someOtherFile.brs then include that in your component’s XML and then you’ll have access to that function

```auto
<script type="text/brightscript" uri="pkg:/components/someOtherFile.brs" />

```

---

<div class="post-metadata">

**Author:** ![NB](https://avatars.discourse-cdn.com/v4/letter/n/54ee81/32.png) [@NB](https://forum.developer.roku.com/u/NB)\
**Post date:** [August 26, 2017, 10:21pm UTC](https://forum.developer.roku.com/t/why-i-cant-access-a-function-in-another-file/6522/3 "2017-08-26T22:21:43Z")

</div>

Brightscript source files are handled differently between SDK1 and RSG apps. The main() function and friends from pkg:/source are automatically compiled together. For RSG XML components however, only the explicitly included .brs files are read for that particular component.

---

<div class="post-metadata">

**Author:** ![neowinston](https://avatars.discourse-cdn.com/v4/letter/n/f04885/32.png) [@neowinston](https://forum.developer.roku.com/u/neowinston)\
**Post date:** [August 29, 2017, 2:44pm UTC](https://forum.developer.roku.com/t/why-i-cant-access-a-function-in-another-file/6522/4 "2017-08-29T14:44:28Z")

</div>

Thanks for the help Joe and RokuNB!
