Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] Barebones version of ImportAll #3965

Open
HLWeil opened this issue Dec 2, 2024 · 1 comment
Open

[Python] Barebones version of ImportAll #3965

HLWeil opened this issue Dec 2, 2024 · 1 comment

Comments

@HLWeil
Copy link

HLWeil commented Dec 2, 2024

Description

I would like to just import the shutil module in python so I can use it in an emit statement somewhere in my code. The problem is I can't seem to get the example from the documentation to work.

Repro code`

REPL

Best case would be if I could just write something like this

[<ImportAll("shutil")>]
let shutil : unit -> unit = nativeOnly

and get

import shutil

but instead I don't get any import statement at all.

So I add a call to the import "function" (as seen in #3481).

[<ImportAll("shutil")>]
let shutil : unit -> unit = nativeOnly
shutil()

Now I get the import statement, but unfortunately also the call which fails, as you can't call a module:

import shutil

shutil()

Related information

@HLWeil
Copy link
Author

HLWeil commented Dec 2, 2024

Also found

importAll "shutil"

which returns

import shutil
shutil

Also looks a bit weird, but it doesn't fail so I'll go with it now.

@HLWeil HLWeil changed the title [Python] ImportAll [Python] Barebones version of ImportAll Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant