As Pedro Maia commented, python naturally can't make simultaneous stuff. So you need a multiprocessing module. For instance you can make a dictionary with the name and frequencies to use and access that dictionary by processes to join. Using the multiprocessing library (comes in the standard library) you can use the multiprocessing.Process(target=function name,args=[arg1,arg2...]) function. Each multiprocess will be assigned a different part of your pc (roughly speaking) to achieve or run the task. When you call the processes with start() you can run parallel tasks, and then you must call join() on them, thats where the script will run on a single process again. You may need to add an innate "stopper" to your function (that stops the while loop) since the multiprocessing may become blind to counters outside the function.
For instance:
import time
def test(name, frequency):
k=0
while k<500:
print(name)
k+=1
time.sleep(frequency)
a=multiprocessing.Process(target=test,args=["one",3])
b=multiprocessing.Process(target=test,args=["two",6])
a.start()
b.start()
a.join()
b.join()
This is an oversimplification and it may be useful to look for a youtube multiprocessing tutorial.
threadingormultiprocessingmodules