In this article, we study the generalized Kadomtsev-Petviashvili equation witha potential $$ (-u_{xx}+D_{x}^{-2}u_{yy}+V(\varepsilon x,\varepsilon y)u-f(u))_{x}=0\quad \text{in }\mathbb{R}^2, $$ where \(D_{x}^{-2}h(x,y)=\int_{-\infty }^{x}\int_{-\infty }^{t}h(s,y)\,ds\,dt \), \(f\) is a nonlinearity, \(\varepsilon\) is a small positive parameter, and the potential \(V\) satisfies a local condition. We prove the existence of nontrivial solitary waves for the modified problem by applying penalization techniques. The relationship between the number of positive solutions and the topology of the set where \(V\) attains its minimum is obtained by using Ljusternik-Schnirelmann theory. With the help of Moser's iteration method, we verify that the solutions of the modified problem are indeed solutions of the original roblem for \(\varepsilon>0\) small enough.