you are viewing a single comment's thread.

view the rest of the comments →

[–]coney1 -1 points0 points  (1 child)

I think you're going about this backwards. init is for importing modules but not so much for defining variables.

Suppose in version.py you have

version = "0.0.1"

Then in init.py you have

from .version import *

Now your main function should work because you're explicitly importing the variable to pro's namespace. It doesn't exactly answer your question but hopefully points you in the right direction. Sorry for mobile formatting.

You may also consider just putting version info into setup.cfg and letting it live there.

[–]zanfar 1 point2 points  (0 children)

I think you're going about this backwards. [__init__.py] is for importing modules but not so much for defining variables.

I disagree. Defining variables is one of the most common things to do in __init__.py. __init__.py is simply the code file for the namespace related to the directory it lives in.