# From flask import Flask,render\_template.request Syntax error: Invalid Syntax

**URL:** <https://discuss.python.org/t/from-flask-import-flask-render-template-request-syntax-error-invalid-syntax/5739>\
**Category:** Python Help\
**Tags:** help\
**Created:** [November 13, 2020, 4:58pm UTC](https://discuss.python.org/t/from-flask-import-flask-render-template-request-syntax-error-invalid-syntax/5739 "2020-11-13T16:58:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![reddy](https://avatars.discourse-cdn.com/v4/letter/r/f9ae1b/32.png) [@reddy](https://discuss.python.org/u/reddy)\
**Post date:** [November 13, 2020, 4:58pm UTC](https://discuss.python.org/t/from-flask-import-flask-render-template-request-syntax-error-invalid-syntax/5739/1 "2020-11-13T16:58:00Z")

</div>

from flask import Flask,render\_template.request  
Syntax error: Invalid Syntax

---

<div class="post-metadata">

**Author:** ![steven.daprano](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/steven.daprano/32/1083_2.png) [@steven.daprano](https://discuss.python.org/u/steven.daprano)\
**Post date:** [November 13, 2020, 11:39pm UTC](https://discuss.python.org/t/from-flask-import-flask-render-template-request-syntax-error-invalid-syntax/5739/2 "2020-11-13T23:39:20Z")

</div>

You can’t use `from...import` to import a dotted name.

There are many ways to get the effect you are trying for. Here is one:

```
from flask import Flask, render_template
request = render_template.request
```

---

<div class="post-metadata">

**Author:** ![reddy](https://avatars.discourse-cdn.com/v4/letter/r/f9ae1b/32.png) [@reddy](https://discuss.python.org/u/reddy)\
**Post date:** [November 19, 2020, 1:33pm UTC](https://discuss.python.org/t/from-flask-import-flask-render-template-request-syntax-error-invalid-syntax/5739/3 "2020-11-19T13:33:04Z")

</div>

same error is getting

---

<div class="post-metadata">

**Author:** ![tuchandra](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/tuchandra/32/2750_2.png) [@tuchandra](https://discuss.python.org/u/tuchandra)\
**Post date:** [November 19, 2020, 5:07pm UTC](https://discuss.python.org/t/from-flask-import-flask-render-template-request-syntax-error-invalid-syntax/5739/4 "2020-11-19T17:07:29Z")

</div>

You wrote:

`from flask import Flask,render_template.request`

Did you perhaps mean:

`from flask import Flask,render_template,request`

with a comma instead of a period?

Knowing that you’re using Flask, it looks like this is a typo. The way you’ve written it implies that `request` is contained in the `render_template` module, but that’s not the case. Both `render_template` and `request` are both top-level imports; you import them straight from `flask`.

The following would be equivalent:

```auto
from flask import Flask
from flask import render_template
from flask import request

```

And for this reason, the usual recommendation is to have your imports separated by spaces:

`from flask import Flask, render_template, request`

so that syntax errors become clearer.
