A batch process for the production of polyamides, based on dicarboxylic acids and on diamines, by 1) feeding the entire amount of monomer composed of linear terminal aliphatic C 4 -C 20 dicarboxylic acids, of linear terminal aliphatic C 4 -C 20 diamines, and, if appropriate, of lactams, in the desired stoichiometry, in a closed stirred-tank reactor, 2) heating the monomer mixture in the stirred-tank reactor, with stirring, and with setting of a certain pressure, to a desired reaction temperature for the production of a prepolymer, where the reaction in stage 2) is carried out at a temperature in the range from 70 to 350°C and at a maximum pressure in the range from 3 to 100 bar and the reaction in the stirred-tank reactor is terminated once the conversion reached is in the range from 50 to 97%, based on the amino groups and carboxy groups, where the intrinsic viscosity of the prepolymer is in the range from 3 to 200 ml/g, determined by solution viscometry, where the polyamide specimens were dissolved in 96 ± 0.1% sulfuric acid in order to prepare a 0.5% strength by weight polymer solution and where the flow time of the solvent and of the polymer solution were determined at 25 ± 0.05°C water bath temperature in an Ubbelohde viscometer, 5) reacting the reaction mixture from stage 2) in the melt in a vented extruder for further increase of the molecular weight, with discharge of water vapor, and without use of additional polyamide-forming monomers or of polyamides, at a temperature in the range from 120 to 370°C and a pressure in the range from 0.01 to 20 bar, where the reaction mixture from stage 2) is passed directly into the vented extruder in stage 5). 1) feeding the entire amount of monomer composed of linear terminal aliphatic C 4 -C 20 dicarboxylic acids, of linear terminal aliphatic C 4 -C 20 diamines, and, if appropriate, of lactams, in the desired stoichiometry, in a closed stirred-tank reactor, 2) heating the monomer mixture in the stirred-tank reactor, with stirring, and with setting of a certain pressure, to a desired reaction temperature for the production of a prepolymer, where the reaction in stage 2) is carried out at a temperature in the range from 70 to 350°C and at a maximum pressure in the range from 3 to 100 bar and the reaction in the stirred-tank reactor is terminated once the conversion reached is in the range from 50 to 97%, based on the amino groups and carboxy groups, where the intrinsic viscosity of the prepolymer is in the range from 3 to 200 ml/g, determined by solution viscometry, where the polyamide specimens were dissolved in 96 ± 0.1% sulfuric acid in order to prepare a 0.5% strength by weight polymer solution and where the flow time of the solvent and of the polymer solution were determined at 25 ± 0.05°C water bath temperature in an Ubbelohde viscometer, 5) reacting the reaction mixture from stage 2) in the melt in a vented extruder for further increase of the molecular weight, with discharge of water vapor, and without use of additional polyamide-forming monomers or of polyamides, at a temperature in the range from 120 to 370°C and a pressure in the range from 0.01 to 20 bar, where the reaction mixture from stage 2) is passed directly into the vented extruder in stage 5).