Updated spawn.py to take a function as argument
Updated spawn.py