Where do you get the pokeflute in Pokemon LeafGreen?

Go to Celadon Game Corner and pull the lever behind the poster, then go through there, beat Team Rocket Boss and grab Silph Scope. After that go to Pokemon tower and get to the top to Mr Fuji, then go with him back to his house and talk to him, he will give you the Poke Flute.