OK, here is a brief, working example.

In my working directory I have the file test.py containing:

# test.py
import mypackage

c=mypackage.MyClass()
c.foo()


In the mypackage directory I have __init__.py and MyClass.py containing:

# __init__.py
from MyClass import MyClass

# MyClass.py
class MyClass:
    def foo(self):
        print 'MyClass.foo() here!'

Running test.py prints 'MyClass.foo() here!' as desired.

Kent

David Driver wrote:
In the root script I import Common. Inside of Common's __init__.py I
import the basic domain modules. Is this correct?



If I understand the setup correctly it should work. How are you

importing Common? If you say

import Common
you should be able to refer to Common.sobjs. If you say

from Common import *

then sobjs will be imported into the main module namespace.

Kent

_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Reply via email to