The alkaloid from deadly nightshade used medically to dilate pupils is atropine.
Atropine is a tropane alkaloid found naturally in deadly nightshade, Atropa belladonna, as well as in other nightshade relatives such as henbane, mandrake, jimsonweed, and Brugmansia. In the eye, it blocks muscarinic acetylcholine receptors in the iris sphincter muscle. That prevents normal constriction and produces mydriasis, or pupil dilation.
Doctors have used atropine eye drops for ophthalmic examinations and in conditions such as uveitis, although its effects can last much longer than those of some newer alternatives. Because it also reduces parasympathetic activity elsewhere, atropine can cause dry mouth, rapid heartbeat, blurred vision, constipation, and urinary retention.
Atropine has other important medical uses: it can treat some forms of slow heart rate and is used in emergencies involving organophosphate pesticides or nerve agents. It was first isolated in the nineteenth century, but belladonna preparations had been used medicinally long before pure atropine was available.
The distractors are unrelated compounds: nicotine is a tobacco alkaloid, caffeine is a methylxanthine, and quinine comes chiefly from cinchona bark.