4

I have two files in source folder (BrightScript project), file a.brs and file b.brs

There is a function in a.brs file

function aa()
    print "Hello World!"
end function

and I want to call it from b.brs

aa()

There is an error

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

I can not understand this problem.Can anybody help me?

javagc
  • 846
  • 1
  • 17
  • 37

2 Answers2

3

In my experience, I missed to import the file's path in my component. So I got similar issue in my code. Once I added this script_file_path in my component file I had got access to those functions

Add these two file paths in your component

<script type = "text/brightscript" uri = "pkg:/source/a.brs"/>
<script type = "text/brightscript" uri = "pkg:/source/b.brs"/>

then from both the files you can access the other file's functions

ganka
  • 191
  • 1
  • 11
  • Is there a way to import a brightscript into another one? For instance, how to use functions from C.brs and B.brs in A.brs and so only import A.brs in any xml. – JCarlosR Apr 21 '21 at 22:49
2

Try Function aa() as Void, it might be missing the type on the function declaration.

Sergio Basurco
  • 3,488
  • 2
  • 22
  • 40