Is there a function $f$ with the following properties


1. $f$ meromorphic at the upper half plane $\mathfrak h$,
2. $f$ is of weight $k$ under a congruence subgroup of $\operatorname{SL}\_2(\mathbb Z)$,
3. $f$ has an essential singularity at $\infty$.


Modular forms or functions are defined to have good behaviour at $\infty$. But I have not seen an example showing that this is a necessary part of the definition.



Modular form not meromorphic at $\infty$
[expanding on my comment to convert it to an answer]


An example is $e^j \varphi$ where $j$
is the $j$-invariant and $\varphi$ is any nonzero form of weight $k$.


In general a holomorphic (or meromorphic) function on the upper half-plane
that is invariant under ${\rm SL}\_2({\bf Z})$ is the same as an entire
holomorphic (or meromorphic) functon of $j$. So for $k=0$ all we need is a
entire function (or a meromorphic function on $\bf C$) that is not a
polynomial (or rational) function. The exponential is a simple example;
there are plenty of others, including functions such as $\tan j$
which has infinitely many poles in each fundamental domain.


