Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[Python] Imports and heritage

Status
Not open for further replies.

tzushky

Member level 3
Joined
May 21, 2007
Messages
63
Helped
10
Reputation
20
Reaction score
0
Trophy points
1,286
Location
Sophia-Antipolis,France
Activity points
1,819
Hello,

I really hope there's someone here who has a little more insight than me. I've been working with python for a while now, but i've stumbled upon something which seems really simple compared to what i've been solving.

The context doesn't really matter, it's for testing an embedded WLAN equipment. I've designed a package, for holding the embedded API (for MIB reading, constants, etc...) and the functions are written as belonging to a class:
Package
pyapi
----------__init__.py --> I define the __all__ list to be sure all my modules
are imported if I write "from pyapi import *"
somewhere (got it from Python Reference)
----------Macros.py ---> contains ApiClass
----------other_files.py

Then I have at the same level as this package a module (=a file) containing a class inheriting the class above: class AP(ApiClass): (so that it has access to functions)

The idea is that the "pyapi" package will be redone for each product version in time, so I could leave a general "from pyapi import *" at the top of the AP class, but I want to leave the import dynamic, only at the beginning of a main where I would import the package first and I expected then to be able to create an AP instance without problems.... But it didn't work....

I have the __init__.py for the packageand for the folder where the APclas and the package are stored, if I put the iport for the package in the class all works fine, if I try to import it in the main at run time, and then make the instance, it doesn't...

Have any of you tried something like this? Or have any ideas?I'd be very grateful...thanks,

T
[/i][/b]
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top