Skip to content
This repository was archived by the owner on Jan 28, 2020. It is now read-only.

Need some help with identical modules imported from two different places #3

@pmulgaonkar

Description

@pmulgaonkar

Love this repo. Am trying to work with it, but am seeing behavior in importing files that I cannot explain.
The simplest way to explain it is this: Consider a minimal set of 3 modules, say main, foo, and bar
main:
imports ihook.py
sets the import hook
imports foo
imports bar

foo:
imports bar

Now if the files are all unencrypted, what I see happening (with a print statement in the Finder function), is that the system tries to find foo, then since foo imports bar, it imports bar from foo. The behavior of this is different when the file is encrypted vs. when it is not.

If the files foo and bar are not encrypted, the Finder shows the calls to be:
Find (foo)
Find (bar)
if the files foo and bar are encrypted, the Finder shows the calls to be
Find (foo)
Find(foo.bar)
This lands up loading bar as foo.bar inside foo, which is a different instance of the module than the one that the main program loads when it imports bar.

What am I missing here. Why is the behavior different between loading the modules encrypted or unencrypted?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions