When the jury wishes to communicate with the court, it shall so notify the sheriff, who shall inform the court thereof. Any communication relative to the cause must be written, prepared by the foreman and shall be submitted to the court through the bailiff. The court shall answer any such communication in writing, and before giving such answer to the jury shall use reasonable diligence to secure the presence of the defendant and his counsel, and shall first submit the question and also submit his answer to the same to the defendant or his counsel or objections and exceptions, in the same manner as any other written instructions are submitted to such counsel, before the court gives such answer to the jury, but if he is unable to secure the presence of the defendant and his counsel, then he shall proceed to answer the same as he deems proper. The written instruction or answer to the communication shall be read in open court unless expressly waived by the defendant.
All such proceedings in felony cases shall be a part of the record and recorded by the court reporter.
Tex. Code Crim. Proc. § 36.27