Patrick's solution is probably the cleanest. If you need to dynamically pick up the module as well, you can import it like:
module = __import__('foo')
func = getattr(module, 'bar')
func()
Patrick's solution is probably the cleanest. If you need to dynamically pick up the module as well, you can import it like:
module = __import__('foo')
func = getattr(module, 'bar')
func()