Let me state it using the language of $D$-modules. Let $X$ be a smooth projective curve and $\mathcal{L}$ a line bundle on it. Assume that $\mathcal{L}$ has a left action of $\mathcal{D}_X$. Then show that $\mathrm{deg}\, \mathcal{L} = 0$.

This is true for $\mathcal{L}=\mathcal{O}_X$ clearly. And this question is purely algebraic. Though it has a proof based in analytic method over $\mathbb{C}$, I would like to ask for a proof in algebraic method, maybe available in positive characteristic.