You can always hack it with the os
module. It's not pretty, but it's probably the best you can do without rewriting all the other guy's code. If you'll be using functions from the other scripts a lot, I'd write a wrapper for the them to make it easier to call them:
import sys
import os
def call_legacy_func(func, *args, **opts):
prev = os.path.abspath(os.getcwd()) # Save the real cwd
try:
# Get the child's physical location.
func_path = sys.modules[func.__module__].__file__
except:
# Die; we got passed a built-in function (no __file__)
# Or you could just call it, I guess: return func(*args, **opts)
return None
# Change to the expected directory and run the function.
os.chdir(func_path)
result = func(*args, **opts)
# Fix the cwd, and return.
os.chdir(prev)
return result
import ChildOneScript.ChildOne as ChildOne
call_legacy_func(ChildOne.myChildFunction, 0, 1, kwarg=False)