You can use the import function to import the module by name and stick that on the files module.
Edit: Changes to show how to call the function
import os
import files
wanted_file = "file1.py"
# name of module plus contained function
wanted_name = os.path.splitext(wanted_file)[0]
# if you do this many times, you can skip the import lookup after the first hit
if not hasattr(files, wanted_name):
module = __import__('files.' + wanted_name)
setattr(files, wanted_name, module)
else:
module = getattr(files, wanted_name)
fctn = getattr(module, wanted_name)
text = 'print this...'
fctn(text)