During or after the pendency of an action for the recovery of a debt secured by a lien mentioned in AS 09.45.170, an action cannot be maintained for the foreclosure of the lien unless judgment is given in that action that the plaintiff recover the debt or a part of it, and an execution issued in the action against the property of the defendant is returned unsatisfied in whole or in part.