title: How to use dynamic variables in cookiecutter hooks?
body: <p>I would like to use dynamic variables inside hooks/pre_gen_project.py.</p>
  <p>When I add a static text inside the hook file it works:</p>
  <pre><code>{{ cookiecutter.update({&quot;venv_path&quot;: &quot;static/venvpath&quot;, &quot;py_path&quot;: &quot;static/pypath&quot;}) }}
  </code></pre>
  <p>But when I tried to use a variable like <code>venv_path_val</code></p>
  <pre><code>venv_path_val = &quot;static/venvpath&quot;
  py_path_val = &quot;static/pypath&quot;
  {{ cookiecutter.update({&quot;venv_path&quot;: venv_path_val, &quot;py_path&quot;: py_path_val }) }}
  </code></pre>
  <p>I am getting</p>
  <blockquote>
  <p>jinja2.exceptions.UndefinedError: 'venv_path_val' is undefined</p>
  </blockquote>
  <p>I also tried it inside <code>eval</code> but no luck:</p>
  <pre><code>eval(&quot;{{ '{{'|safe }} cookiecutter.update({'venv_path': venv_path, 'py_path': py_path}) {{ '}}'|safe }}&quot;)
  </code></pre>
  <p>So is there a way to inject my dynamic template variables inside cookiecutter?</p>