Python3 - How do I import a class from another file

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Dec 8 17:52:05 EST 2019


On 9/12/19 6:28 am, R.Wieser wrote:
> 
>> Are you sure there's a difference between classes and functions here?
> 
> Yes, quite sure.

And we're even more sure that there isn't. :-) Try it with
a test module containing a class definition, a function
definition and some top-level code that does something
noticeable. You'll find that *any* form of import executes
all the top-level code.

-- 
Greg



More information about the Python-list mailing list