Skip to content

Unable to import and use a Python Module simultaneously in do form #1028

Closed
@ikappaki

Description

@ikappaki

Hi,

It seems that it's not possible to import and use a Python module within a do form simultaneously

unable to resolve symbol 'logging/getLogger' in this context

To reproduce, open a REPL and try importing and using the logging module within a do form

basilisp.user=> (do (import logging) (logging/getLogger "abc"))

  exception: <class 'basilisp.lang.compiler.exception.CompilerException'>
      phase: :analyzing
    message: unable to resolve symbol 'logging/getLogger' in this context
       form: logging/getLogger
   location: <REPL Input>:1

However, the same code works as expected when not using the do form:

basilisp.user=> (import logging) (logging/getLogger "abc")
<Logger abc (WARNING)>

I would expect this to work inside a do form as well.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions