Example 7.6.3 in Hartshorne is about the following setup: Take the nonsingular cubic $X$ defined by $y^2z=x^3-xz^2$ in $\mathbb{P}_k^2$ and $P_0=(0:1:0)$. Hartshorne claims that $\mathcal{O}_X(1)\cong L(3P_0)$, but I don't really see why this is true.
Very ample line bundle on a projective curve (also about this question) explains that the hyperplane defined by $z=0$ restricts to the divisor $3P_0$, and we also know that $z=0$ (along with any hyperplane) corresponds to $O(1)$ (in $\mathbb{P}_k^2$).
Now, to conclude, I want to say that the pullback of a line bundle associated to the divisor of some rational section is the same as the line bundle associated to the divisor of the pullback of this rational section, but I don't know in what generality this holds. Should I be working with Cartier or Weil divisors---it doesn't matter in this case (they are the same), but I'm interested in what one is allowed to do in a more general situation. Hartshorne also doesn't seem to address pullbacks of Weil or Cartier divisors for some reason.
In any case, it seems like we need some condition like the image of the morphism isn't contained in the support (of say a Weil divisor), since otherwise trying to define the pullback just gives rise to the source scheme (which is not a Weil divisor). Is something like this also sufficient/what hypotheses do we need to have on the schemes?