So I know that if $f \in \mathscr{M}_{k}(N,\chi)$ has Fourier expansion $$f(z) = \sum_{n \ge 0}a(n)e^{2\pi inz},$$ and $\psi$ is a primitive character modulo $M$, then the twist $$(f \otimes \psi)(z) = \sum_{n \ge 0}a(n)\psi(n)e^{2\pi inz}$$ lives in $\mathscr{M}_{k}(NM^{2},\chi\psi^{2})$. The proof essentially uses the primitivity of $\psi$ to write $$\psi(n) = \frac{1}{\tau(\bar{\psi})}\sum_{r \pmod{M}}\bar{\psi}(r)e^{\frac{2\pi irn}{M}},$$ and from here you interchange sums etc. What I am curious about is if the primitivity of $\psi$ can be dropped. I've looked around the stack and it seems that this is possible (see https://mathoverflow.net/questions/158278/modular-form-on-gamma-0n). However, I am unsure how one would prove this. By multiplcativity of the characters you can assume $\psi$ is principal but then you can't use this sum trick above. In the case that the modulus is odd you could use squares of primitive quadratic characters given by the Jacobi symbol to get the result, but can you do better? It seems odd to exclude the case that $M$ is even since this generally doesn't cause issues for holomorphic forms (as far as I know).
Motivation for the question: In certain moment problems one studies the family $\{L(s,f \otimes \psi)\}_{\psi \pmod{M}}$. But for all of these $L$-functions to have nice properties such as analytic continuation, functional equation, etc. we need $f \otimes \psi$ to be a holomorphic form. This is clear if $\psi$ is primitive but it is not clear if $\psi$ is induced.
Nforms into levelNpforms, and then applying the operator you callT_pat levelNp. – David Loeffler Dec 01 '24 at 18:22