I am trying to access my Geometry Imports in all scripts within a repository in Google Earth Engine (for testing purposes, I want to make a copy of my main script that also has all of the Geometry Imports). By accident, I created a new script that happens to have my Geometry Imports from my main script, but I cannot figure out how that happened. Every time I try to create a new script with the Scripts Manager New drop-down button, it creates a new, empty script, but I cannot see the Geometry Imports from my main script in that repository.
How can I make a copy of a script (or a new one) that also has the Geometry Imports visible in another script in that same repository?
Best Answer
You can make the script that has the Geometry Imports a module that you can import into other scripts by exporting the vars you need with
exports
and then in your script import them withrequire
.E,g, script named "imports" with the Geometry imports:
Script named "script" that gets the geometry variables from "imports" and does something with them: