E2036 Syntax Errors

Syntax

imports must be at the top of the file, not inside a function

When this occurs

Import statement inside a function or block

Example error message

error[E2036]: import statement must be at file level, not inside a function

How to fix

Move the import statement to the top of the file, outside of any function or block.

Related errors