I recently asked this question on Math.StackExchange with no answer so far. So I thought maybe I can find an answer here.
Let $M(k,\Gamma_0(N))$ be a space of modular forms of weight $k$ on $\Gamma_0(N)$. Each $f \in M(k,\Gamma_0(N))$ has a Fourier expansion of the form $$ f(\tau)=\sum_{n\in \mathbb{N}}a(n)\,q^n \quad \text{where}\quad q=\mathrm{e}^{2\pi \mathrm{i}\tau} . $$
Now, let $g(\tau)$ be a function obtained from $f(\tau)$ by omitting all $a(n)$ such that $\gcd(n,N)\neq 1$, i.e. $$ g(\tau)=\sum_{\substack{n\in \mathbb{N}\\(n,N)=1}}a(n)\,q^n . $$
Question: Is $g(\tau)$ a modular form? What is its level?
Many thanks.