w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Mixing functions and subpackages in Python packages

Solution #1: Try the following layout:


In this case Transform.fft goes inside lib/Transform/__init__.py and Transform.bins.extent inside lib/Transform/bins.py

Solution #2: If you wish to keep __init__.py short and clean, you can also create a separate Python-module (like fft.py) and import it in __init__.py as follows:

from fft import *

In which case you can also use:

from lib.Transform import fft

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.