- Learn the melody and make variations by changing the rhythm, replacing notes or leaving out notes.
(I also did this a lot with small parts I heard from other instruments. Take the idea, make variations, make it work on the other chords of the song)
- transcribe other instruments: horns, right hand piano, guitar,... etc
(check this out! https://basslessons.be/transcriptions.php?i=8 - variations on the melody and an excellent solo)
- re-harmonise: G7 - C ==> Dm7 - G7 - C ==> Dm7 - Db7 - C etc
- use a melodic or rhythmic idea and try to make as much variations as possible.
And what a lot of musicians forget: silence ads to music too. One of the first exercises in Hal Crook's "How to improvise" is : Play 2 measures / don't play for 2 measures. (don't count those measures, try to 'feel' them)