Modulation takes places within a composition or a movement of a composition.
There needs to be a cadence in the new key. Modulation requires the ability of the listener to remember the old key and be able to compare it with the current key. Two keys that sound the same but are written differently. A change of key between two enharmonically equivalent keys is not a modulation since the tonic has not changed. Since the tonic has not changed, no modulation has taken place.