Python call function directory from local() using exec

Python call function directory from local() using exec

Currently I do something like this:
pyfd = open("some_python_script.py", "r")
src = pyfd.read()
pyfd.close()
exec(src) #Note, also tried eval and execfile, I use read as I do
something with it.
locals()["some_function"]("foo", "bar")
It works great, however when I leave the function I notice that both
Globals and Locals don't have the "some_function" function anymore. (I
expect its the Garbage Collection)
My question is, how can I append my code read from some python file to my
other code?
I know this is bad practice and insecure etc etc. But I want to make it in
a way that I "py2exe" my main part and that my user can append Python
code. He can destroy the entire app by overwriting functions and what not
but I can 100% trust the user.
Thanks, Stolas