0

I organized my helper method into this way:

enter image description here

All the methods are used in the current file, so I need to import them like this:

from helpers.utility_helper import *
from helpers.app_helper import *
from helpers.gmm_helper import *
from helpers.plot_helper import *

So I can directly use methods in each of the submodule. For example, use my_helper() instead of helpers.utility_helper.my_helper().

But this looks quite verbose, is it possible to combine them into one line? Something may look like

import * from helpers/*

ZK Zhao
  • 19,885
  • 47
  • 132
  • 206

1 Answers1

0

I would advise to use explicit imports instead of importing whole:

from helpers.utility_helper import my_helper, your_helper

This will help to avoid mistakes.

For short names you can use as:

import helpers.utility_helper as util
import helpers.app_helper as app
import helpers.gmm_helper as gmm
import helpers.plot_helper as plot

It is quite normal practice.

JRazor
  • 2,707
  • 18
  • 27