osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cant't use package internals


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?