The opium poppy contains a wide range of alkaloids and has been a very valuable medicine, especially useful in bringing relief from pain. Its use (especially of the extracted alkaloids opium and morphine which it contains) can become addictive, however, and so it should be treated with extreme caution and only be used under the supervision of a qualified practitioner. The dried juice (latex) from the unripe green seed vessels is a rich source of the active alkaloids, including morphine. It is extracted by making shallow incisions in the capsules as soon as the petals have fallen. Care must be taken that the incisions do not penetrate to the interior of the seed capsules. The latex exudes from the capsules and dries in contact with the air - it is then scraped off. This latex is anodyne, antitussive, astringent, diaphoretic, emmenagogue, hypnotic, narcotic and sedative. As well as its pain-relieving properties, the latex has also been used as an antispasmodic and expectorant in treating certain kinds of coughs, whilst its astringent properties make it useful in the treatment of dysentery etc. A homeopathic remedy is made from the dried latex. This is used in the treatment of a variety of complaints, including constipation, fevers and insomnia. Source: https://pfaf.org/
Find more about this plant on Wikipedia.