Py.height() problem

py.height () is reading the last block.
So why read the new block and read it in the previous block.
How do I keep the old block from reading when the new block appears

Actually, you were querying not a single node but pool of nodes. It’s quite possible that not all the nodes in the pool are in sync for a few blocks.