I think that there is a problem with importing functions inside controllers "directly". You could place the function in a module (i.e in modules/mymodule.py and do from mymodule import ff)
On 3 ene, 05:07, Martin Weissenboeck <[email protected]> wrote: > Hi, > I want to measure some times. > > My code: > > def ff(): > return 2*3 > > def tm(): > import timeit > t1 = timeit.Timer(stmt='a=2*3').timeit(number=100)/100 > t2 = timeit.Timer(stmt='a=ff()',setup='from __main__ import > ff').timeit(number=100)/100 > return dict(t1=t1, t2=t2) > > t1 is ok, but t2 gives an error: ImportError: cannot import name ff > I understand, that __main__ is not a good idea, but what would be the > correct name? > > Regards, Martin

