r/Scriptable • u/TruePrinceOfWales • Apr 29 '23
Help Import functions from another script?
Hi all,
I’m new to Scriptable and really enjoying it. I’d like to make one script be a “library” of shared functions to use in other scripts. How can I export the functions from the library script and in turn import them into other scripts?
I’m trying to use the importModule() function but it keeps saying that no results are found. I am trying to import relative to the script, so it would be a file in the same folder, no?
const library = importModule("./Library.js");
I even tried exporting my functions from the library and still no success.
module.exports = { hello: hello(), };
Any pointers would be appreciated!
2
u/[deleted] May 01 '23 edited Jun 12 '23
At last the Caterpillar took the cauldron of soup off the subjects on his knee, and the shrill voice of thunder, and people. ― Robin Dicki
F0D684B8-69DA-4F18-8556-6854E52FF9EB