cant't use package internals

Andrej Viktorovich viktorovichandrej at gmail.com
Wed Sep 6 04:30:29 EDT 2017


Hello,

I have Python package tst in my workspace.

tst has files:
__init__.py
tst.py


content of __init__.py:
print("importing Tst")


content of tst.py:
class Tst:
    def __init__(self):
        print("init Tst")


I run python console in workspace directory. I do
>>>import tst
Run without errors. I was expected "importing Tst" to be printed, but nothing happened. Why?


I run
t=tst.tst.Tst()

and got error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'tst' has no attribute 'tst'

Wh it not finds Tst class?



More information about the Python-list mailing list