To answer my own question models are executed and not imported so are
already in the globals namespace.

Therefore instead of using getattr one can use:

globals()[tablename]()

On Oct 8, 5:57 pm, apple <simo...@gmail.com> wrote:
> tableclass=getattr(tableclasses, tablename)
>
> Works fine when tableclasses is in modules but not when it is in
> models - says "global name tableclasses is not defined".
>
> Is it possible to access by name a class defined in models?

Reply via email to