Forking is probably the Right Thing To Do, here, and daemonising better, but a simple way to get mostly the same effect, without changing the script is (as the comment on the question suggests) to simply put the script in the background.
What &
won't do, however, is fully relinquish the connection to the terminal. For that, use nohup
:
(nohup python foo.py >foo-output &)
is a simple way of daemonising a script. The nohup
means that the process won't be killed when its controlling terminal goes, and putting the script into the background of a subshell (...)
, which then exits, means that it ends up as the child of the init process. That's most of what 'daemonising' means, in effect.
This is a more general technique than the original question really calls for, but it's useful nonetheless.