Merge pull request #302 from psha-/301-import-multiple-go-packages

Fixes a leftover bug to properly handle multiple go packages when gen…
This commit is contained in:
Randall O'Reilly 2022-12-15 02:22:32 -08:00 committed by GitHub
commit daea424b18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -552,7 +552,11 @@ func (g *pyGen) genPkgWrapOut() {
impstr := ""
for _, im := range g.pkg.pyimports {
if g.mode == ModeGen || g.mode == ModeBuild {
impstr += fmt.Sprintf("import %s\n", im)
if g.cfg.PkgPrefix != "" {
impstr += fmt.Sprintf("from %s import %s\n", g.cfg.PkgPrefix, im)
} else {
impstr += fmt.Sprintf("import %s\n", im)
}
} else {
impstr += fmt.Sprintf("from %s import %s\n", g.cfg.Name, im)
}