Symbolic functions, as created via function('V')(phi), accept only symbolic expressions (i.e. elements of the Symbolic Ring) for their arguments. Hence the error message that you get. To derive the equations of motion, I would advise to introduce, in addition to the scalar field phi, a symbolic expression, phi0 say, that will represent the scalar field as the argument of the potential V:
phi0 = var('phi0', latex_name=r'\phi')