Copy link to clipboard
Copied
Hey, So I am trying to seprate code for readablity. I have two files so far. I am trying to import the file into the main file. I tried using #include but i got an error saying I could not use it outside a class. I saw online another example //@include but that does not work. It just comments out the import. What is the proper way of importing a file ?
This example works for me. Create a file named HelloWorld.jsxinc with a function you want to run:
/**
* Discription
* @ param a string
* @ return string
*/
function helloWorld(s){
return "From Hello World: " + s
}
Save the .jsxinc file in the same directory with the script that will include it—here is an example script that incudes the .jsxinc file:
#include "HelloWorld.jsxinc"
alert(helloWorld("Hi There!"))
The include sample run:
Copy link to clipboard
Copied
Copy link to clipboard
Copied
thank you
Copy link to clipboard
Copied
This example works for me. Create a file named HelloWorld.jsxinc with a function you want to run:
/**
* Discription
* @ param a string
* @ return string
*/
function helloWorld(s){
return "From Hello World: " + s
}
Save the .jsxinc file in the same directory with the script that will include it—here is an example script that incudes the .jsxinc file:
#include "HelloWorld.jsxinc"
alert(helloWorld("Hi There!"))
The include sample run:
Copy link to clipboard
Copied
@Victor29751988fsbx , if solution by @rob day does not work, could you post your separate code file, so that we can help?
Copy link to clipboard
Copied
Thanks they have been really helpful
Find more inspiration, events, and resources on the new Adobe Community
Explore Now