The USSR’s M-XV class of small submarines was designed before WWII, were built and served during the war before being put out of production, and then quite remarkably were put back into production after WWII; only to leave service very soon after.
(M-294 of the Soviet navy at sea.)
Despite being almost totally forgotten today these WWII submarines served long into the Cold War era, in some cases into the 1970s, and were helpful to several navies looking to establish a modern submarine force.
(S10 was Egypt’s first submarine ever. It was formerly the Soviet M-271.)