Python Forum
passing a value to imported code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
passing a value to imported code
#1
i would like to pass a value to imported code in order for it to make a decision at import time (such as which way to define a function). the first way i tried was to set the value as a global variable before doing the import and accessing that variable inside the module very early. could this be because i am using from modulename import functionname to do the import?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to acquire an imported file creation time thunderspeed 4 274 Sep-23-2021, 04:27 PM
Last Post: Larz60+
  [newbie] Why is a module imported twice? Winfried 3 2,059 Apr-02-2021, 04:48 AM
Last Post: deanhystad
  how to do setattr() from an imported module nutron 3 1,516 Sep-20-2019, 08:16 PM
Last Post: nutron
  argparse and imported modules spatialdawn 2 3,151 Dec-01-2018, 12:35 PM
Last Post: spatialdawn
  global namespace of an imported function (2 Qs) Skaperen 4 1,656 Oct-09-2018, 12:30 AM
Last Post: Skaperen
  function NOT imported from a module Skaperen 10 3,046 Aug-31-2018, 07:30 AM
Last Post: Gribouillis
  [SYS + OS] Script not Imported, Error Found ! JamieVanCadsand 2 2,305 Sep-22-2017, 08:03 PM
Last Post: snippsat
  decorate an imported function? Skaperen 3 5,743 May-22-2017, 08:05 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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