The Walther HP was the immediate predecessor to the P38 pistol that was adopted into widespread German service. The HP (Heeres Pistole, or Army Pistol) was offered for commercial sale and export by Walther. It was formally adopted by the Swedish army in 1939, but only a small number were shipped before the outbreak of war caused Walther to reprioritize for German military production. A number of HPs were also sold commercially to Austria military men, and those pistols often wound up in German military service after the annexation of Austria.
When the German military adopted the pistol, it dictated a few minor changes from the standard HP design, and the result became the P38.