See ofn-extract-objects here: https://sourceforge.net/projects/gimp-to...s/scripts/
Basically it makes an alpha-selection, and converts it to a path. That path has exactly as many strokes as there are "islands" in the selection, so the script breaks the multi-stroke path into as many single-stroke paths, and iterates them to make a selection restricted to one islands, and copies it to a new layer.
For a crash course on paths: https://www.gimp-forum.net/Thread-Paths-Basics
Basically it makes an alpha-selection, and converts it to a path. That path has exactly as many strokes as there are "islands" in the selection, so the script breaks the multi-stroke path into as many single-stroke paths, and iterates them to make a selection restricted to one islands, and copies it to a new layer.
For a crash course on paths: https://www.gimp-forum.net/Thread-Paths-Basics