Python Forum
[solved] What is the best/pytonic way to import with dependency ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[solved] What is the best/pytonic way to import with dependency ?
#1
Hi everyone,

I would like to create a module (let's call it FooBar) that I could import in few of my "main" programs.

But the functions within FooBar rely on other modules... that are already imported inside the main program.

is there a way that the FooBar doesn't need to import them too ?

Because the following is not working.

MAIN.py
import sqlite3
from FooBar import *

test()
FooBar.py
def test():
    with sqlite3.connect('aSQLitedb') as connection....
Error:
NameError: name ‘sqlite3’ is not defined
Thanks.
[Image: NfRQr9R.jpg]
Reply


Messages In This Thread
[solved] What is the best/pytonic way to import with dependency ? - by SpongeB0B - Jul-08-2023, 07:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Solved] Import syntax SpongeB0B 1 808 Dec-28-2022, 08:37 AM
Last Post: Gribouillis
  Request Dependency warning thetechnodino 0 957 Dec-20-2022, 02:12 AM
Last Post: thetechnodino
  Circular import dependency hobbyist 9 3,979 Feb-23-2021, 11:57 AM
Last Post: Gribouillis
  Poetry Dependency general Help felipesodre 0 1,470 Jan-14-2021, 07:46 PM
Last Post: felipesodre
  Installing nltk dependency Eshwar 0 1,862 Aug-30-2020, 06:10 PM
Last Post: Eshwar
  How do I change wx version dependency? belfacode 0 1,587 May-17-2020, 09:18 AM
Last Post: belfacode
  Module Dependency installation error draems 10 10,362 Feb-12-2017, 08:18 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020