May-09-2020, 07:10 PM
(This post was last modified: May-10-2020, 07:29 PM by escape_freedom13.)
Hi All,
Scenario 01:
module:
master program:
Output will be:
module:
master program:
Output will be:
I found a long way as below:
Scenario 03:
module:
master program:
Output will be:
Scenario 04:
module:
master program:
Output will be:
Linux Mint
python3.6
IDLE3
Scenario 01:
module:
1 2 3 4 5 |
import time def printtime(): print (time.time()) |
1 2 3 4 5 6 |
import module module.printtime() print ( list (module.time.gmtime())) |
Output:1589049932.1866198
[2020, 5, 9, 19, 7, 41, 5, 130, 0]
Scenario 02:module:
1 2 |
def printtime(): print (time.time()) |
1 2 3 4 5 6 |
import time import module module.printtime() |
Output:NameError: name 'time' is not defined
I can import library in module and use it in master program but importing library in master program and use it in module functions won't work. I want to import python library in my master script and use it in python module functions directly. In other words, Scenario 02 to work.I found a long way as below:
Scenario 03:
module:
1 2 |
def printtime(time): print (time.time()) |
1 2 3 4 5 6 |
import time import module module.printtime(time) |
Output:1589049932.1866198
But I want some more direct way like:Scenario 04:
module:
1 2 |
def printtime(): print (SOMETHING.time.time()) |
1 2 3 4 5 6 |
import time import module module.printtime() |
Output:1589049932.1866198
Is there any way? Please help me out.Linux Mint
python3.6
IDLE3