An electronic device, comprising: a communication circuit; a sensor circuit; a digitizer panel (570, 645); and a processor (120, 650) operatively connected to the communication circuit, the sensor circuit, and the digitizer panel, wherein the processor is configured to: detect whether an electronic pen is detached from the electronic device via the sensor circuit, activate the digitizer panel based on detecting detachment of the electronic pen from the electronic device, identify a state of the electronic pen through a communication linkage with the electronic pen via the communication circuit, deactivate the activated digitizer panel based on the identified state of the electronic pen; wherein identifying the state of the electronic pen comprises: determine a distance to the electronic pen based on a strength of a communication signal with the electronic pen, identify whether a movement of the electronic pen is detected for a designated time based on sensor information received from the electronic pen, and if the determined distance is greater than a designated range and the movement of the electronic pen is not detected for the designated time, deactivate the activated digitizer panel. a communication circuit; a sensor circuit; a digitizer panel (570, 645); and a processor (120, 650) operatively connected to the communication circuit, the sensor circuit, and the digitizer panel, wherein the processor is configured to: detect whether an electronic pen is detached from the electronic device via the sensor circuit, activate the digitizer panel based on detecting detachment of the electronic pen from the electronic device, identify a state of the electronic pen through a communication linkage with the electronic pen via the communication circuit, deactivate the activated digitizer panel based on the identified state of the electronic pen; wherein identifying the state of the electronic pen comprises: determine a distance to the electronic pen based on a strength of a communication signal with the electronic pen, identify whether a movement of the electronic pen is detected for a designated time based on sensor information received from the electronic pen, and if the determined distance is greater than a designated range and the movement of the electronic pen is not detected for the designated time, deactivate the activated digitizer panel. detect whether an electronic pen is detached from the electronic device via the sensor circuit, activate the digitizer panel based on detecting detachment of the electronic pen from the electronic device, identify a state of the electronic pen through a communication linkage with the electronic pen via the communication circuit, deactivate the activated digitizer panel based on the identified state of the electronic pen; wherein identifying the state of the electronic pen comprises: determine a distance to the electronic pen based on a strength of a communication signal with the electronic pen, identify whether a movement of the electronic pen is detected for a designated time based on sensor information received from the electronic pen, and if the determined distance is greater than a designated range and the movement of the electronic pen is not detected for the designated time, deactivate the activated digitizer panel. determine a distance to the electronic pen based on a strength of a communication signal with the electronic pen, identify whether a movement of the electronic pen is detected for a designated time based on sensor information received from the electronic pen, and if the determined distance is greater than a designated range and the movement of the electronic pen is not detected for the designated time, deactivate the activated digitizer panel.