Partial derivatives of canonical momenta in Poisson brackets I will simply give an example for a general doubt about the Hamiltonian formulation. So, consider the spherical pendulum of length $l$ as an example of my perhaps more general question.
The Lagrangian is given by
$${\displaystyle L={\frac {1}{2}}ml^{2}\left({\dot {\theta }}^{2}+\sin ^{2}\theta \ {\dot {\phi }}^{2}\right)+mgl\cos \theta .}$$
and the conjugate momenta are
$${\displaystyle P_{\theta }={\frac {\partial L}{\partial {\dot {\theta }}}}=ml^{2}\cdot {\dot {\theta }}}$$
and $${\displaystyle P_{\phi }={\frac {\partial L}{\partial {\dot {\phi }}}}=ml^{2}\sin ^{2}\!\theta \cdot {\dot {\phi }}}. \tag{1}$$
Lastly, the Hamiltonian can be calculated via the Legendre transform to be
$$H=P_{\theta }{\dot {\theta }}+P_{\phi }{\dot {\phi }}-L = {P_{\theta }^{2} \over 2ml^{2}}+ {P_{\phi }^{2} \over 2ml^{2}\sin ^{2}\theta }-mgl\cos \theta.$$
Now, $\phi$ is cyclic and hence, $P_{\phi}$ is conserved. I should be able to verify this via the Poisson brackets. In particular, I should find that
$$\{P_{\phi}, H\}=0$$
However, when expanding the Poisson bracket, I find myself with the term
$$\frac{\partial p_{\phi}}{\partial \theta} \frac{\partial H}{\partial p_{\theta}}$$
which using Eq. (1) doesn't seem to vanish. However, if I simply postulate that the canonical momenta $p_{\phi},p_{\theta}$ be independent of the coordinates $\phi, \theta$, then this term does indeed vanish.
How does one reconcile this? On the one hand, we define the conjugate momenta and in particular $p_{\phi}$ seems to clearly depend on $\theta$ but then in the next step, we simply claim to view them as independent.
 A: When evalauating  partial derivatives you need to specify what is being kept fixed as well as what is varying. The Poisson bracket is
$$
\{F(p,q),G(p,q)\}=\sum_i \left(\frac{\partial F(q,p)}{\partial q_i}\right)_{p_i} \left(\frac{\partial G(q,p)}{\partial p_i}\right)_{q_i}- \left(\frac{\partial F(q,p)}{\partial p_i}\right)_{q_i} \left(\frac{\partial G(q,p)}{\partial q_i}\right)_{p_i}. 
$$
So yes
$$
\left(\frac{\partial p_\phi}{\partial \theta}\right)_{p_{\phi}}=0.
$$
A: It's just like in thermodynamics, you need to keep track which variables you are using as coordinates for your function. It's always a good idea to formulate things in a coordinate independent perspective.
$L$ is defined on the coordinates $q_i,v_i$. For an actual trajectory, $v_i = \dot q_i$ but from the point of view of $L$ they are all independent variables. For a coordinate independent description, $L$ is defined on the tangent bundle of the configuration space, starting from a coordinate system $q_i$ of the configuration space, you get a new natural coordinate system of the tangent bundle $q_i,v_i$.
When you go to the Hamiltonian formalism, you are doing a change of coordinates $q_i,p_i$. $H$ is therefore a function of these independent variables. For a coordinate independent description, $H$ is defined on the cotangent bundle of the configuration space. However, starting from a coordinate system $q_i$ of the configuration space you don't have a natural coordinate system of the cotangent bundle $q_i,p_i$, you'll need $L$ to define it.
The Poisson bracket is defined on two functions of the cotangent space, so they are functions of $q_i,p_i$ which are all treated as independent. There is actually a coordinate independent definition of the Poisson bracket, which I won't detail here, check out Arnold's Mathematical Methods for Classical Mechanics, which motivates the above formula.
Hope this helps.
A: The independent coordinates (on the cotangent bundle of the configuration space) for describing the Hamiltonian are $(\theta,\phi,p_{\theta},p_{\phi})$. So, almost by definition, $\frac{\partial (\text{one of these four guys})}{\partial(\text{one of the three other guys})}=0$, in particular, $\frac{\partial p_{\phi}}{\partial\theta}=0$. The reason you're getting confused is you're overloading the same symbols (namely $p_{\theta}$ and $p_{\phi}$) to have two different meanings. On the one hand, you write the common but muddled equation, $p_i=\frac{\partial L}{\partial \dot{q}^i}$, so this seems to be a function of $q,\dot{q}$, and on the other hand, we have to use $(\theta,\phi,p_{\theta},p_{\phi})$ as a coordinate system, and it is this double usage which confuses you.

A single Variable Analogue.
Suppose $I,J\subset\Bbb{R}$ are open intervals, and $E:I\to\Bbb{R}$ is a given smooth function, $\Phi:I\to J$ a given diffeomorphism (smooth map with smooth inverse), and define $H:J\to\Bbb{R}$ as the mapping $H:=E\circ\Phi^{-1}$. For the sake of concreteness, let us take

*

*$I=\Bbb{R}$, $J=(0,\infty)$,

*$E:\Bbb{R}\to\Bbb{R}$ the function $E(x)=x+e^x$,

*$\Phi:\Bbb{R}\to (0,\infty)$ the diffeomorphism $\Phi(x)=e^x$, so $\Phi^{-1}:(0,\infty)\to\Bbb{R}$ is $\Phi^{-1}(y)=\log(y)$.

*$H:(0,\infty)\to\Bbb{R}$ is then the defined as $H=E\circ\Phi^{-1}$, which yields $H(y)=(\log y) + y$.

If I now ask you to compute the derivative $H'(y)$, you'll immediately tell me that since $H(y)=\log y + y$, then $H'(y)=\frac{1}{y}+1$, and there's no doubt about it. Notice that there's nothing special about the letters $x$ and $y$. If I wanted to, I could say $E(t)=t+e^t$, and $H(t)=(\ell\circ\Phi^{-1})(t)=\log t + t$. This is perfectly correct mathematically.
Now, this same procedure is typically presented in physics texts without introducing
a name for the diffeomorphism $\Phi$. It is typically presented as saying:

Consider the function $E(x)=x+e^x$, and make the change of variables $y=e^x$ to get a function $H(y)$. This function equals, $H(y)=\log y + y$, so $H'(y)=\frac{1}{y}+1$.

Notice that there is still an overload of notation in this description! The same symbol $y$ is first being used in place of the diffeomorphism $\Phi$, and second it is used as the argument of the function $H$. It is just that one might be too comfortable with single-variable calculus that they gloss over the notational overload.
In any case, the bottom line is once you make the change of coordinates (i.e composing by $\Phi^{-1}$), you should forget about whatever happened before (i.e the $x$-coordinates).

The Original Question, in Modified Notation.
What I described above is exactly what we're doing when we change from Lagrangian to Hamiltonian mechanics. We start with an energy function $E:\Bbb{R}^{2n}\to\Bbb{R}$ in Lagrangian mechanics (here $n=2$), and use a diffeomorphism $\Phi$ between open subsets of $\Bbb{R}^{2n}$ (this is the Fiber derivative of the Lagrangian, $\mathbf{F}L:TQ\to T^*Q$ in fancy differential geometry jargon), and using this we 'change coordinates' to get the Hamiltonian $H:=E\circ\Phi^{-1}$.
What follows might be slightly difficult to read initially because I'm going to use non-standard letters to denote the independent variables, but hopefully after this you'll appreciate the difference between the choice of coordinates and the diffeomorphism used.

*

*The Lagrangian. This is a function $L:\Bbb{R}^4\to\Bbb{R}$, given as
\begin{align}
L(x_1,x_2,y_1,y_2)&=\frac{ml^2}{2}\left(y_1^2+\sin^2(x_1)y_2^2\right)+ mgl\cos(x_1).
\end{align}
Compared with the standard notation, here I used $(x_1,x_2,y_1,y_2)=(\theta,\phi,\dot{\theta},\dot{\phi})$.
The choice of letters is of course insignificant, I can also write something like $L(a,b,c,d)=\frac{ml^2}{2}\left(c^2+\sin^2(a)d^2\right)+ mgl\cos(a)$.


*The Energy. This is the function $E:\Bbb{R}^4\to\Bbb{R}$ defined as
\begin{align}
E(x_1,x_2,y_1,y_2)&=y_1\frac{\partial L}{\partial y_1}\bigg|_{(x_1,x_2,y_1,y_2)}+
y_2\frac{\partial L}{\partial y_2}\bigg|_{(x_1,x_2,y_1,y_2)} - L(x_1,x_2,y_1,y_2)\\
&=y_1\cdot ml^2y_1 + y_2\cdot ml^2\sin^2(x_1)y_2
-\bigg( \frac{ml^2}{2}\left(y_1^2+\sin^2(x_1)y_2^2\right)+ mgl\cos(x_1)\bigg)\\
&=\frac{ml^2}{2}\left(y_1^2+\sin^2(x_1)y_2^2\right)- mgl\cos(x_1).
\end{align}


*The Fiber Derivative. This is the mapping $\Phi:\Bbb{R}^4\to\Bbb{R}^4$, defined as
\begin{align}
\Phi(x_1,x_2,y_1,y_2)&:=\left(x_1,x_2, \frac{\partial L}{\partial y_1}\bigg|_{(x_1,x_2,y_1,y_2)}, \frac{\partial L}{\partial y_2}\bigg|_{(x_1,x_2,y_1,y_2)}\right)\\
&=\bigg(x_1,x_2, ml^2y_1, ml^2\sin^2(x_1)y_2\bigg).
\end{align}
This map becomes a diffeomorphism if we restrict the domain and target sufficiently, in which case, the inverse map is
\begin{align}
\Phi^{-1}(\xi_1,\xi_2,\eta_1,\eta_2)&=\bigg(\xi_1,\xi_2,\frac{\eta_1}{ml^2},\frac{\eta_2}{ml^2\sin^2\xi_1}\bigg).
\end{align}


*The Hamiltonian. This is the composed mapping $H:=E\circ \Phi^{-1}$. So, after some computation,
\begin{align}
H(\xi_1,\xi_2,\eta_1,\eta_2)&=E(\Phi^{-1}(\xi_1,\xi_2,\eta_1,\eta_2))\\
&=\dots\\
&=\frac{\eta_1^2}{2ml^2}+\frac{\eta_2^2}{2ml^2\sin^2\xi_1}-mgl\cos\xi_1.
\end{align}
Now, in the Lagrangian, we have $\frac{\partial L}{\partial x_2}=0$, so we expect that for the Hamiltonian side, $\{\eta_2,H\}=0$, and indeed, we can verify this is the case:
\begin{align}
\{\eta_2,H\}&=\left(\frac{\partial \eta_2}{\partial \xi_1}\frac{\partial H}{\partial \eta_1}- \frac{\partial \eta_2}{\partial \eta_1}\frac{\partial H}{\partial \xi_1}\right)
+
\left(\frac{\partial \eta_2}{\partial \xi_2}\frac{\partial H}{\partial \eta_2}- \frac{\partial \eta_2}{\partial \eta_2}\frac{\partial H}{\partial \xi_2}\right)\\
&=0-0+0-\frac{\partial H}{\partial \xi_2}\\
&=0,
\end{align}
since the partials of $\eta_2$ with respect to the other coordinates $\xi_1,\xi_2,\eta_1$ are trivially $0$, while $\frac{\partial\eta_2}{\partial\eta_2}=1$ and finally since $H$ doesn't depend on $\xi_2$.
If you want to compare notation, then $(\xi_1,\xi_2,\eta_1,\eta_2)=(\theta,\phi,p_{\theta},p_{\phi})$. Anyway, the takeaway is that you need to distinguish between the coordinates used to describe the Lagrangian/Hamiltonian, and the diffeomorphism $\Phi$ which allows you to convert between the two formalisms.
