  The aim of this work is to characterize HCN and CH$_3$OH emission from recent
comets.
  We used the Onsala 20-m telescope to search for millimetre transitions of HCN
towards a sample of 11 recent and mostly bright comets in the period December
2016 to November 2019. Also CH$_3$OH was searched for in two comets. The HCN
sample includes the interstellar comet 2I/Borisov. For the short-period comet
46P/Wirtanen we could monitor the variation of HCN emission over a time span of
about one month. We performed radiative transfer modelling for the observed
molecular emission by also including time-dependent effects due to the
outgassing of molecules.
  HCN was detected in 6 comets. Two of these are short-period comets and 4 of
them are long-period. Six methanol transitions were detected in 46P/Wirtanen,
enabling us to determine the gas kinetic temperature. From the observations, we
determined the molecular production rates using time-dependent radiative
transfer modelling. For 5 comets, we could determine that the HCN mixing ratios
lie near 0.1% using contemporary water production rates, $Q_\mathrm{H_2O}$,
taken from other studies. This HCN mixing ratio was also found typical in our
monitoring observations of 46P/Wirtanen but here we notice deviations, on a
daily time scale, up to 0.2% which could indicate short-time changes in the
outgassing activity. From our radiative transfer modelling of cometary comae,
we found that time-dependent effects on the HCN level populations are of the
order 5-15% when $Q_\mathrm{H_2O}$ is around $2\times 10^{28}\,\mathrm{mol\,
s^{-1}}$. The effects may be relatively stronger for comets with lower
$Q_\mathrm{H_2O}$. The exact details of the time-dependent effects depend on
the amount of neutral and electron collisions, radiative pumping, and molecular
parameters such as the spontaneous rate coefficient.
