A substrate working machine comprising: a bending device configured to bend a lead of a leaded component inserted into a through-hole formed in a board; wherein the bending device includes a contacting section (144, 149) configured to bend the lead via contact with the lead, and a main body section to which the contacting section (144, 149) is removably attached, characterized by an imaging device; and a control device, wherein the control device is configured to memorize a standard position of the contacting section (144, 149), the control device includes an imaging section configured to use the imaging device to capture an image of a predetermined imaging target of the contacting section (144, 149), a calculating section configured to calculate position information that is information related to an attachment position of the contacting section (144, 149) on the main body section based on imaging data captured by the imaging section, and a calibration performing section configured to perform calibration related to the attachment position of the contacting section (144, 149) to the main body section in a case in which a difference between position information calculated by the calculating section and the standard position of the contacting section (144, 149) memorized by the control device exceeds a threshold value. a bending device configured to bend a lead of a leaded component inserted into a through-hole formed in a board; wherein the bending device includes a contacting section (144, 149) configured to bend the lead via contact with the lead, and a main body section to which the contacting section (144, 149) is removably attached, characterized by an imaging device; and a control device, wherein the control device is configured to memorize a standard position of the contacting section (144, 149), the control device includes an imaging section configured to use the imaging device to capture an image of a predetermined imaging target of the contacting section (144, 149), a calculating section configured to calculate position information that is information related to an attachment position of the contacting section (144, 149) on the main body section based on imaging data captured by the imaging section, and a calibration performing section configured to perform calibration related to the attachment position of the contacting section (144, 149) to the main body section in a case in which a difference between position information calculated by the calculating section and the standard position of the contacting section (144, 149) memorized by the control device exceeds a threshold value. an imaging section configured to use the imaging device to capture an image of a predetermined imaging target of the contacting section (144, 149), a calculating section configured to calculate position information that is information related to an attachment position of the contacting section (144, 149) on the main body section based on imaging data captured by the imaging section, and a calibration performing section configured to perform calibration related to the attachment position of the contacting section (144, 149) to the main body section in a case in which a difference between position information calculated by the calculating section and the standard position of the contacting section (144, 149) memorized by the control device exceeds a threshold value.