An electronic device comprising: a housing, a display viewable through a portion of the housing; a wireless communication circuit disposed within the housing; at least one processor disposed within the housing and operatively connected with the display and the wireless communication circuit; and a memory disposed within the housing and operatively connected with the at least one processor, wherein the memory stores instructions that, when executed, configure the at least one processor to: establish a wireless communication link, which is based on a short-range wireless communication protocol, with a stylus pen inserted into an inner space of the housing, through the wireless communication circuit, receive a signal including information about a battery state of the stylus pen from the stylus pen, through the wireless communication circuit and the short-range wireless communication protocol, measure a status of the wireless communication link, detect that the stylus pen is detached from the housing, display a graphical user interface, GUI, including a first GUI indicating the battery state and a second GUI indicating the measured status of the wireless communication link through the display, based at least on the information about the battery state and the measured status of the wireless communication link; and no longer display the first GUI and the second GUI through the display in response to detecting that the stylus pen is inserted into the inner space of the housing. a housing, a display viewable through a portion of the housing; a wireless communication circuit disposed within the housing; at least one processor disposed within the housing and operatively connected with the display and the wireless communication circuit; and a memory disposed within the housing and operatively connected with the at least one processor, wherein the memory stores instructions that, when executed, configure the at least one processor to: establish a wireless communication link, which is based on a short-range wireless communication protocol, with a stylus pen inserted into an inner space of the housing, through the wireless communication circuit, receive a signal including information about a battery state of the stylus pen from the stylus pen, through the wireless communication circuit and the short-range wireless communication protocol, measure a status of the wireless communication link, detect that the stylus pen is detached from the housing, display a graphical user interface, GUI, including a first GUI indicating the battery state and a second GUI indicating the measured status of the wireless communication link through the display, based at least on the information about the battery state and the measured status of the wireless communication link; and no longer display the first GUI and the second GUI through the display in response to detecting that the stylus pen is inserted into the inner space of the housing. establish a wireless communication link, which is based on a short-range wireless communication protocol, with a stylus pen inserted into an inner space of the housing, through the wireless communication circuit, receive a signal including information about a battery state of the stylus pen from the stylus pen, through the wireless communication circuit and the short-range wireless communication protocol, measure a status of the wireless communication link, detect that the stylus pen is detached from the housing, display a graphical user interface, GUI, including a first GUI indicating the battery state and a second GUI indicating the measured status of the wireless communication link through the display, based at least on the information about the battery state and the measured status of the wireless communication link; and no longer display the first GUI and the second GUI through the display in response to detecting that the stylus pen is inserted into the inner space of the housing.