This paste expires on 2023-06-20 12:35:05.975762. Repaste, or download this paste. . Pasted through web.

import package.module as module
if __name__ == '__main__':
    print(module.foo())
Filename: main.py. Size: 86b. View raw, , hex, or download this file.
from . import imported
def foo():
    return imported.value
if __name__ == '__main__':
    print(foo())
Filename: package/module.py. Size: 111b. View raw, , hex, or download this file.
value = 42
Filename: package/imported.py. Size: 10b. View raw, , hex, or download this file.
$ python main.py
42
$ python package/module.py
ImportError: attempted relative import with no known parent package
Filename: None. Size: 117b. View raw, , hex, or download this file.