When does a modular form satisfy a differential equation with rational coefficients? Given a modular form $f$ of weight $k$ for a congruence subgroup $\Gamma$, and a modular function $t$ with $t(i\infty)=0$, we can form a function $F$ such that $F(t(z))=f(z)$ (at least locally), and we know that this $F$ must now satisfy a linear ordinary differential equation
$$P_{k+1}(T)F^{(k+1)} + P_{k}(T)F^{(k)} + ... + P_{0}(T)F = 0$$
Where $F^{(i)}$ is the i-th derivative, and the $P_i$ are algebraic functions of $T$, and are rational functions of $T$ if $t$ is a Hauptmodul for $X(\Gamma)$.
My question is the following:

given a modular form $f$, what are necessary and sufficient conditions for the existence of a modular function $t$ as above such that the $P_i(T)$ are rational functions?


For example, the easiest sufficient condition is that $X(\Gamma)$ has genus 0, by letting $t$ be a Hauptmodul.
But, this is not necessary, as the next condition will show.
Another sufficient condition is that $f$ is a rational weight 2 eigenform. I can show this using Shimura's construction* of an associated elliptic curve, and a computation of a logarithm for the formal group in some coordinates (*any choice in the isogeny class will work).
Trying to generalise, I have thought of the following: if $f$ is associated to a motive $h^i(V)$ of a variety $V$, with a pro-representable Artin-Mazur formal group $\Phi^i(V)$ of dimension 1, then we can construct formal group law a-la Stienstra style, and get a logarithm using the coefficients of powers of a certain polynomial. This makes the logarithm satisfy a differential equation with rational functions as coefficients. Since the dimension is 1, the isomorphism back to "modular coordinates" will be a single modular function $t$, and this answers the question positively.
This was the original motivation for the question - a positive answer is weaker, but maybe suggests the existence of associated varieties to rational eigenforms. 
Putting non-eigenforms aside, since I'm not interested as much in them, we are left with non-rational eigenforms. We can try to perform the same Stienstra construction, but this time we get that the galois orbit of $f$ is associated to a "formal group law" of a motive with dimension greater than one. This will make for an interesting recurrence for the vector of the galois orbit, but not necessarily for each form individually, as the isomorphism of formal groups laws (between Stienstra's and those with the modular forms as logarithm) might scramble them together. Maybe not, and this solves might the question.
I realise this last paragraph might be difficult to understand, for the wording is clumsy, and the mathematical notions are even worse. If you're really interested in this, I'd be happy to elaborate.
 A: Let $K$ be the algebraic closure of the differential field $\mathbb{C}(T)$. 
Let $\partial$ denote differentiation w.r.t. $T$.  Now $\mathbb{C}(T)[\partial] \subseteq K[\partial]$ are rings of differential operators. Your function $F$ is a solution of $L(F)=0$ where $L \in K[\partial]$ is the differential operator $L = P_{k+1} \partial^{k+1} + \cdots + P_0 \partial^0$. The rings $\mathbb{C}(T)[\partial]$ and $K[\partial]$ (multiplication = composition) satisfy all properties of a Euclidean domain except commutativity. In particular, one can define an LCLM (least common left multiple) which behaves just like an LCM in Euclidean domains.
Let $L_1,\ldots,L_d$ be the conjugates of $L$ over $\mathbb{C}(T)$, obtained by applying ${\rm Gal}(K/\mathbb{C}(T))$ to $P_{k+1},\ldots,P_0$. Now let $M = {\rm LCLM}(L_1,\ldots,L_d)$. Then $M \in \mathbb{C}(T)[\partial]$ and $M$ is right-divisible by $L$. In particular $M(F)=0$.
In summary: Any function $F$ that satisfies a linear differential operator $L$ with algebraic-function coefficients will also satisfy a linear differential operator $M$ with rational-function coefficients. In Maple you can find $M$ with the command DEtools[LCLM](L, `and conjugates`);
