Calling a script from within a script

Greetings,

I have two scripts: one which creates annotations from a pixel classifier, and another which performs StarDist cell detection on selected annotations. Is there a way to call the cell detection script after the pixel classifier script, other than copy-pasting the two scripts into one?

Cheers,

Mark

While you can call groovy files from within groovy, I don’t exactly recommend it since, if I recall correctly, the called script does not have all of the nice features that the original script takes for granted. No default imports, immediate access to the current image, stuff like that. Everything would have to be rewritten as if it were inside of a function or similar code block (like onAction for buttons).

I would have to look back to figure it out again, but at the time it did not end up seeming worth the trouble. I think the method was not QuPath specific though, just groovy scripts calling groovy scripts.