Molting and pupation require the hormone, PTTH, secreted by a cluster of cells in the brain of the larva. If these cells are cut out of the brain of a full-grown larva, pupation does not occur. PTTH does not drive pupation directly but, as its name suggests, acts on the prothoracic glands . There are two prothoracic glands located in the thorax. Under the influence of PTTH, they secrete the steroid hormone ecdysone .
Juvenile hormone is secreted by two tiny glands behind the brain, the corpora allata .
With lower amounts of JH, ecdysone promotes pupation. Complete absence of JH results in formation of the adult. So if the corpora allata are removed from an immature silkworm, it immediately spins a cocoon and becomes a small pupa. Conversely, if the corpora allata of a young silkworm are place in the body of a fully-mature larva, metamorphosis does not occur. The English insect physiologist V. B. Wigglesworth showed that if juvenile hormone is first applied to the insect's exoskeleton, the regions affected by it revert to larval type after this extra molt.