0

I've created a package called pack with a couple of modules, organized like this:

pack
 |--pack
    |-- __init__.py
    |-- main.py
    |-- controller.py
 |--setup.py
 |--README.md

In main.py and controller.py I have all the functions that I need from the package. In this case, in order to call just_a_random_function inside controller.py I would have to do:

from pack import controller

controller.just_a_random_function

But I need to make this easier, like this:

import pack
pack.just_a_random_function

I think I'm a little bit lost about how I need to organize my package, what do I need to change in order to, just importing the package, being able to call all the package functions?

Stack
  • 1,028
  • 2
  • 10
  • 31

1 Answers1

0

As suggested in some coments and in this answer, the solution would be to add this into __init__.py file:

from pack.controller import just_a_random_function

Then, in order to call just_a_random_function(), I just need to import pack:

import pack
pack.just_a_random_function
Stack
  • 1,028
  • 2
  • 10
  • 31