An image forming apparatus to and from which a replenishment container accommodating developer is attachable and detachable and which is configured to execute an image formation in which a developer image is formed on a recording material, the image forming apparatus comprising: an image bearing member configured to rotate while bearing the developer image; a developer bearing member configured to bear the developer and supply the developer to the image bearing member; a developer container including: an accommodating portion configured to accommodate the developer to be borne on the developer bearing member; and a replenishment port to and from which the replenishment container is attachable and detachable and through which the accommodating portion is replenished with the developer from the replenishment container; an agitation member configured to agitate the developer accommodated in the accommodating portion; an opening/closing member configured to be movable between a closed position where the opening/closing member closes the replenishment port such that the replenishment container is not attachable to the developer container, and an open position where the opening/closing member opens the replenishment port such that the replenishment container is attachable to the developer container; an opening/closing sensor configured to detect whether the opening/closing member is at the open position or at the closed position; and a control means configured to control driving of the agitation member, characterized in that an execution of the image formation is possible when the opening/closing sensor detects that the opening/closing member is at the closed position, and the execution of the image formation is not possible and the driving of the agitation member is possible when the opening/closing sensor detects that the opening/closing member is at the open position. an image bearing member configured to rotate while bearing the developer image; a developer bearing member configured to bear the developer and supply the developer to the image bearing member; a developer container including: an accommodating portion configured to accommodate the developer to be borne on the developer bearing member; and a replenishment port to and from which the replenishment container is attachable and detachable and through which the accommodating portion is replenished with the developer from the replenishment container; an accommodating portion configured to accommodate the developer to be borne on the developer bearing member; and a replenishment port to and from which the replenishment container is attachable and detachable and through which the accommodating portion is replenished with the developer from the replenishment container; an agitation member configured to agitate the developer accommodated in the accommodating portion; an opening/closing member configured to be movable between a closed position where the opening/closing member closes the replenishment port such that the replenishment container is not attachable to the developer container, and an open position where the opening/closing member opens the replenishment port such that the replenishment container is attachable to the developer container; an opening/closing sensor configured to detect whether the opening/closing member is at the open position or at the closed position; and a control means configured to control driving of the agitation member, characterized in that an execution of the image formation is possible when the opening/closing sensor detects that the opening/closing member is at the closed position, and the execution of the image formation is not possible and the driving of the agitation member is possible when the opening/closing sensor detects that the opening/closing member is at the open position.