The class of almost finitely presented groups which admit a finite index subgroup which is an HNN extension is characterised using Scott's end invariant for a pair of groups. As in Scott's original paper on the subject the profinite topology plays a role