TypeError: 'module' object is not callable ; why not?

Francis Belliveau via Tutor <[email protected]> Fri, 12 Dec 2025 17:58:43 -0500
Newsgroups gmane.comp.python.tutor
Message-ID <[email protected]>
I am sure that I am missing something fundamental when it comes to creating packages of classes.

in my working directory I have a .py file containing the following:

import sequencers.SequenceInt
si1 = sequencers.SequenceInt(-1, -9, -3)
print(si1.next())

That same directory contains a subdirectory called sequencers that contains two files:
  __init__.py and SequenceInt.py

The __init__.py file contains only comments.

The SequenceInt.py file starts with the following code exerpt:

class SequenceInt:
    def __init__(self, first, last, inc = 1,
                 alwaysIterFromFirst = False, alwaysIncludeLast = False):
        self.__LAST = int(last)
        self.__FIRST = int(first)

I think that is enough to cover this issue.

When I execute the top-level script, the line "si1=" produces the error:

TypeError: 'module' object is not callable

I am wondering why because I do not see any attempt to "call" an object, only the attempt to "construct" an object.

Am I missing something needed to make the constructor publically callable?

Fran

_______________________________________________
Tutor maillist  -  To unsubscribe send an email to [email protected]
To unsubscribe or change subscription options:
%(web_page_url)slistinfo/%(_internal_name)s