A series of high‐molecular weight condensation polyimides prepared from pyromellitic dianhydride (PMDA) or 3,3,4,4′‐benzophenone tetracarboxylic dianhydride (BTDA) with 4,4′‐oxydianiline (ODA) and/or 1,5‐diaminonaphthalene (NA), and a series of high‐molecular weight condensation poly(amide–imides) prepared from trimellitic anhydride acid chloride (TMAC) with ODA and/or NA were evaluated to determine, in the temperature region 50–250°C, the effect of polymer molecular structure on the permeability and ideal permselectivity of hydrogen, oxygen, nitrogen, and methane. Replacement of ODA with NA generally decreases the permeability of each gas but it increases the permselectivity, which is explained by suppression of both the packing disruption effect and intrasegmental mobility of the amine segments. In general, the overall lower permeation values for the TMAC series of polyimides are much lower than the BTDA‐derived series, being the highest for the PMDA‐derived series. Permeation data were used to calculate the performance of a hollow fiber module on an industrial scale. It is shown that hydrogen can be efficiently recovered (> 90%) with a purity of at least 95% from ammonia synthesis off‐gas with a feed concentration of 61 mol % of hydrogen. Copyright © 1990 John Wiley & Sons, Inc.