Answer
$f(x)=\sec^2x$ is not continuous in $(0,\pi)$, and hence FTC-2 cannot be applied.
Work Step by Step
According to the fundamental theorem of calculus, $\int_a^bf(x)dx = F(b)-F(a)$, where $F$ is the antiderivative of $f$ or $F'=f$, provided that $f$ is continuous in $(a, b)$.
Here, $\sec^2x=\frac{1}{\cos^2x}$ is not continuous in $(0,\pi)$ and has an infinite discontinuity at $x=\pi/2$.