Developing the topochemical polymerization of metal-organic frameworks (MOFs) is of pronounced significance for expanding their functionalities but is still a challenge on third-order nonlinear optics (NLO). Here, we report diacetylene MOF (CAS-1-3) films prepared using a stepwise deposition method and film structural transformation approach, featuring dynamic structural diversity. The MOF structures were determined by the three-dimensional electron diffraction (3D ED) method from nanocrystals collected from the films, which provides a reliable strategy for determining the precise structure of unknown MOF films. We demonstrate the well-aligned diacetylene groups in the MOFs can promote topological polymerization to produce a highly conjugated system under thermal stimulation. As a result, the three MOF films have distinct NLO properties: the CAS-1 film exhibits saturable absorption (SA) while CAS-2 and CAS-3 films exhibit reverse saturable absorption (RSA). Interestingly, due to the topochemical polymerization of the MOF films, a transition from SA to RSA response was observed with increasing temperatures, and the optical limiting effect was significantly enhanced (∼46 times). This study provides a new strategy for preparing NLO materials and thermally regulation of nonlinear optics.