As one approaches the continuum limit, QCD systems, investigated via numerical simulations, remain trapped in sectors of field space with fixed topological charge. As a consequence the numerical studies of physical quantities may give biased results. The same is true in the case of two dimensional CP N −1 models. In this paper we show that metadynamics, when used to simulate CP N −1 , allows to address efficiently this problem. By studying CP 20 we show that we are able to reconstruct the free energy of the topological charge F (Q) and compute the topological susceptibility as a function of the coupling and of the volume. This is a very important physical quantity in studies of the dynamics of the θ vacuum and of the axion. This method can in principle be extended to QCD applications.