I am unsure whether I got it right but I think it is in Revelations. It says the devil is in God's court at his feet cursing him and all in the court. This is meant to be before the devil is sent to earth. So if this is true how can he be in hell?
I have never read in the Bible a scene such as you described. The closest is the first two chapters of the book of Job, in the Old Testament. In that scene, Satan is before God, apparently as part of a regular accounting. He does not curse God. Instead God asks him about a righteous man named Job, and Satan says that this man would curse God if he weren't protected by him. God gives Satan permission to harm Job, except for taking his life.
When did this take place? Does it mean that Satan can visit God in heaven? Can Satan still ask God to withdraw his protection from men? I don't know the answers to these questions.
There is a partial answer to the last one in Luke 22:31-32. "And the Lord said, Simon, Simon, behold, Satan hath desired to have you, that he may sift you as wheat: But I have prayed for thee, that thy faith fail not: and when thou art converted, strengthen thy brethren." It seems, then, that Satan still asks for permission to harm men.
But your question was how Satan can be in hell if he was before God's throne. I am not sure that the scriptures teach that Satan is now in hell. Jesus calls him "the prince of this world." (John 112:31, 14:30, and 16:11) Peter says he is active in this world. "Be sober, be vigilant; because your adversary the devil, as a roaring lion, walketh about, seeking whom he may devour." (1 Peter 5:8) Matthew 25:31-46 gives a picture of what appears to be the final judgement. In verse 41 it says, "Then shall he say also unto them on the left hand [those judged for eternal punishment], Depart from me, ye cursed, into everlasting fire, prepared for the devil and his angels." While this doesn't say when Satan will be cast into the everlasting fire, it does at least imply that the time for that may be the same time he casts the souls of men there. The picture of Satan as the ruler of hell is most likely inaccurate. Instead of ruling there, he will be punished there just like all sinners and nobody will be in charge.