Aggregation-induced emission (AIE)-active switchable rotaxaneTR2with two different molecular stations and arm-terminated TPE units at both ends, and their derivatives were synthesized by means of threading, followed by the stoppering tacticviaclick chemistry. The AIE behavior of thread A1 and rotaxanes (TR1,TR2, andTR3) in CH3CN were activated by tuning water fractions (fw), which induced the development of various well-defined nanostructures including spheres, nanorods, truncated cubes, and nanocubesviathe self-assembly of scaffolds. These AIE changes and distinct nanostructures formation verify that the reported analogous rotaxanes were controlled by the shuttling movements of the macrocycle along with wide ranges of multi-non-covalent interactions. The anion-templated construction of rotaxaneTR2with a high level of structurally complex design always encounters more challenging tasks. Evidently, the key to the design involved encoding flexible arms on both triazolium motifs, and exhibited an impressive selectivity and sensitivity (with a detection limit of 0.20 μM) towards the complementary H2PO4−ion species. The specific mechanical molecular motion and host-guest interactions of mechanically interlocked molecules (MIMs) were also further explored by quantum mechanical calculations. Importantly, the AIE changes of rotaxanesTR1,TR2, andTR3were further supported by their bioimaging applications and specifically, rotaxaneTR2could be applied toin vitroimaging with H2PO4−at subcellular levels. This flexible multi-component synthetic strategy affords access to the systematic tuning of molecular structures and self-assembled architectures, and it will inspire further studies on the self-assembly of TPE-containing MIMs for materials science and biological applications.