console = code.InteractiveConsole(locals())
if target in inventory:
    console.push("items[target]['on_eat']")
else:
    print('You have no ' + target + ' to eat.')
Вызов кода в строке без exec/eval, python