When declaratory relief is sought, all persons who have or claim any interest which would be affected by the declaration shall be joined as parties who have or claim any interest which would be affected by the declaration, and no declaration shall be binding against persons not so joined as parties to the proceeding. In any proceeding which challenges the validity of a municipal ordinance or franchise, such municipality shall be made a party. If the statute, ordinance or franchise is alleged to be unconstitutional, the attorney general also shall be given notice and provided an opportunity to appear and be heard in accordance with the provisions of K.S.A. 75-764, and amendments thereto.
K.S.A. 60-1712