[SOLVED] Is it possible to use a function from another script in the same project?

Hey guys!

I’m learning how to use Playcanvas and I’m enjoying it. But I would like to know how I import functions from other scripts within the same project, in order to reuse code blocks from other scripts.

Thank you for your attention and I look forward to it.

Hi @lucas_anjos and welcome!

Do you mean you want to access a function of another script at runtime?

That should be something like below.

1 Like

You can most likely also just have some functions in the other script being available to other scripts if you set its loading order to be before those other scripts.

1 Like

Thank you very much, that was exactly what I needed :wink:

1 Like