Ground wire light switch to outlet
The NEC allows connecting to a ground from another circuit if that circuit originates in the same panel.
If they do originate in different panels or a subpanel the Code also allows connecting to any point on the grounding electrode system, the grounding electrode conductor, the ground bar in the panel where the circuit originates, or the grounded conductor in the service enclosure. (NEC 250.130, free clunky access the NEC at https://www.nfpa.org/codes-and-standards/all-codes-and-standards/list-of-codes-and-standards/detail?code=70 )