python - Using imported modules within an imported function -


i have script runs standalone program, i'd able use callable function well. when try , run script, errors saying modules not defined/imported. example:

nameerror: global name 'exp' not defined 

here's example of code produces error:

from postrec3 import *            ##import required functions module      numpy import array, shape, math, loadtxt, log10, vstack, arange scipy.integrate import quad        pylab import                 numpy import pi pi            assimulo.solvers.sundials import ida  assimulo.problem import implicit_problem math import exp, log10, fabs, atan, log import pickle import sys  results = postrec(2,100,90,1.0,1, 1,"0",2 )  #run imported function 

output:

nameerror: global name 'exp' not defined 

i've tried importing exp within function itself, doesn't change anything. far i'm aware, long i've imported them before using function should available other functions use. so, there wrong i'm doing, or point error within code itself?

o/s: ubuntu 12.10 python 2.7 64 bit

import exp , other module/function need @ top of postrec3 module, not whithin particular function.

imports not "global", each module needs import needs run, if module did so.


Comments