Why does the anesthetic put you right to sleep?

The centers of sleep, pain, and sensation are all in the brain, so if you inhibit the activity of the brain, you will be able to eliminate pain and fall asleep right away. The principle of anesthesia is that anesthetics are injected or inhaled into the cerebral cortex to produce a sedative and analgesic effect. General anesthetics, whether inhalation anesthetics or intravenous anesthetics, act on the central nervous system of the human brain, through a variety of chemical effects, central inhibition, so that the central nervous system and the brain unconsciousness, causing sleep, and at the same time, unable to feel pain. However, there is a time limit to the effect of anesthetics, and once the anesthesia time is over, the patient can wake up from the sleep state.