in line 7 should work.
yield expects an object and a signal, so whatever
counter() returns will be used as the object in Line 7. This normally wouldn't work (functions that return nothing, return
Null), but since
counter() also has a
yield statement this is what happens:
counter() will return a
GDScriptFunctionState the first time it hits
yield in there (Line 15). This is what gets passed into the
_ready. So the
yield in line 7 will wait for the signal
GDScriptFunctionState (which does exist), and not for the
completed signal of your own class.
Also notice that using
counter(n, 2.0) will wait 3 * 2 = 6 seconds :).