Noddy with submodules?

T

Torsten Mohr

Hi,

i want to write a Python module that interfaces a DLL that we use in the
office to do some measurement.

So i'd like to write a python module in C (which i did before some times).

But i'm not sure how i can create a module in a way that i can later do:

import measurement
import measurement.adc
import measurement.adc.channels
import measurement.pwm

What do i need to do to create submodules within the initialisation code
of a python module written in C?

Maybe there is an example based on "noddy"?


Thanks for any hints,
Torsten.
 
G

Gabriel Genellina

So i'd like to write a python module in C (which i did before some
times).

But i'm not sure how i can create a module in a way that i can later do:

import measurement
import measurement.adc
import measurement.adc.channels
import measurement.pwm

What do i need to do to create submodules within the initialisation code
of a python module written in C?

I think it's easier to write a wrapper module in Python. See the xml.etree
package; the cElementTree.py Python module just contains "from
_elementtree import *" (_elementtree being a C extension)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top