Reputation: 2258
In javascript I can import * as bar from 'moduleFoo'
.
Is there an analogous method in Python3?
Upvotes: 1
Views: 67
Reputation: 280500
import moduleFoo as bar
You may not need the as bar
, though. Unlike in Javascript, import moduleFoo
already inserts the moduleFoo
module object into the current namespace under the name moduleFoo
, containing all bindings defined in the module.
Upvotes: 2