or don't use exec(): f=[getattr(fs,a) for a in dir(fs) if a[0:2]!='__' and type(getattr(fs,a))==types.FunctionType] >>> f [<function negate at 0x100a00>, <function square at 0x144038>] >>> f[0](n) -5 >>> f[1](n) 25