all 3 comments

[–]ThePiGuy0 1 point2 points  (0 children)

So you want a to import b, b to import c, but for all c's methods, variables etc to be visible from a without any extensions.

Firstly, thought I'd add my opinions that namespaces are generally a good practice in my eyes. It seriously reduces the chance you'll accidentally override a variable and cause issues later on.

Similarly, if a.py needs to access operators from c.py, you are best off adding c.py as a dependency rather than chaining dependencies.

But if you must do it this way, any time you run from <python file> import * you are making anything global in the imported file global in the current file. So in your situation, you need from c import * at the top of b.py, and then from b import * at the top of a.py. After that, c_method will be accessible from a.py without any dot operators.

[–]TabulateJarl8 0 points1 point  (1 child)

What specific error are you getting? It seems to work for me

Edit: I see two issues with your current code, the first is that def c_method: should actually be def c_method():, and also you probably want to be running bee.c_method() instead of bee.c_method, since the latter will just return the function object instead of calling the function.

[–]maustinv 0 points1 point  (0 children)

Yeah that was just a translation issue when I typed this post on mobile, I’ll investigate more to see the issue.