Am Montag, 4. April 2005 12:23 schrieb Jim:
I can call MyFiles methods inside methods of the Brances classes.
I cannot call Numeric methods inside methods of the Brances classes.
1. I was surprised I could call MyFiles methods in Branches methods.
2. Since I was used to using modules imported in the parent module I was
surprised I couldn't use Numeric methods.
1. I can't answer you this one without looking at the actual code, but
2. You can never call any methods/classes which you imported in a "parent"
module (actually, there's no such motion as parent module, as each module has
its own namespace, and references to this namespace may appear anywhere else
in another module).
In case this worked sometime ago and you didn't explicitly import the module
in the "child" module, you silently did something like the following:
Mod1.py
-------
import Numeric
import Mod2
# Put the namespace (module object) in another namespace
Mod2.Numeric = Numeric
<blah>
Mod2.py
-------
<blah>
What you need for your simulation program is probably something like the
following:
Simulation.py
-------------
import MyFiles
import Branches
import Numeric
print MyFiles.Branches is Branches # True
print MyFiles.Numeric is Numeric # True
print Branches.Numeric is Numeric # True
MyFiles.py
----------
import Branches
import Numeric
print Branches.Numeric is Numeric # True
Branches.py
-----------
import Numeric
HTH!
--
--- Heiko.
listening to: aenima_13_aenima.mp3
see you at:
http://www.stud.mh-hannover.de/~hwundram/wordpress/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQBCURv9f0bpgh6uVAMRArqpAJ934gNxmcJsFwUEswjdJ/fupC3CQgCdEKBS
ZONr0a90q5iQeqO46XWepXs=
=WQk5
-----END PGP SIGNATURE-----