dgsob  
                
               
                 
              
                  
                    November 9, 2023, 11:54am
                   
                   
              1 
               
             
            
              Hi,
I have a file where I include files:
include("./path/File1.jl")
include("./path/File2.jl")
 
and then I want to call functions from these files, and since they have the same name, i wanted to use the file’s names as discriminators:
File1.function()
File2.function()
 
These are my functions, so I can just change their names and it’ll be good, but is it possible to achieve what I’m trying to?
             
            
               
               
               
            
            
           
          
            
              
                oheil  
                
               
              
                  
                    November 9, 2023, 11:57am
                   
                   
              2 
               
             
            
              You are looking for Modules: Modules · The Julia Language  
A distinction based on the source file name is not possible (AFAIK).
             
            
               
               
              1 Like 
            
            
           
          
            
              
                gdalle  
                
               
              
                  
                    November 9, 2023, 12:34pm
                   
                   
              3 
               
             
            
              Conceptually, the include keyword just copy-pastes the code in the target file. Unlike Python’s import, it does not create a separate namespace (or module): in Julia, namespaces and files are disconnected.
If you really prefer Python-like behavior, take a look at GitHub - Roger-luo/FromFile.jl: Julia enhancement proposal (Julep) for implicit per file module in Julia 
             
            
               
               
              1 Like 
            
            
           
          
          
            
              
                mkitti  
                
               
              
                  
                    November 9, 2023, 12:47pm
                   
                   
              5 
               
             
            
            
               
               
              1 Like