Isn't that the perq of the legislative body rather than the judiciary?

Well, duh! Do I have to lay out the whole scenario for you? Seufz! The SC state legislature (legislative branch) votes to consider secession from the Union. They appoint a lawyer (or, more likely assign the job to the state Attorney General {executive branch}) to argue the case before a Federal judge (judicial branch). As soon as they win they vote to finalize the Articles of Secession and go merrily on their way. Until the actual vote on the A of S they are still in the Union and subject to the Federal Court; after the secession they don't have anything to argue.

If the Federal Senate passes some law says cain't nobody secede, the state wishing to secede challenges the constitutionality of that law in federal court.